Skip to content

How to stop bulk deletion for permissions and roles #245

@antonio-pavlov

Description

@antonio-pavlov

Hi i extend the model like this:

<?php

namespace App\Filament\Resources;

use Althinect\FilamentSpatieRolesPermissions\Resources\PermissionResource as BasePermissionResource;
use Filament\Tables\Table;

class PermissionResource extends BasePermissionResource
{
    public static function getNavigationBadge(): ?string
    {
        return static::getModel()::count();
    }

    public static function getNavigationBadgeColor(): string|array|null
    {
        return 'warning';
    }

 public static function table(Table $table): Table
    {
        return parent::table($table)
            ->bulkActions([]);
    }
} 

I added the table method with the idea of ​​overwriting the original one and stopping the bulk options because I don't want the permissions to be able to be deleted, but it didn't work. Do you know how I can do it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions