Is it possible to disable to select a record in bulk action or somehow to disable delete bulk action

I have table with roles, roles can be edited but not all roles can be deleted i want to disable the option of deleting the role with name admin i did in table but i am not able to stop delete role with bulk action delete is it possible to disable the delete bulk action on some record or disable the select the record
7 Replies
toeknee
toeknee4w ago
Just fail it when going to delete? If role = X return false ?
mile4841
mile48414w ago
that would be bad UX
toeknee
toeknee4w ago
hmm debatable, but you can try to condition the visibility based on records ->visible(fn($records) => logic )
mile4841
mile48414w ago
i am getting the error
->bulkActions([
Tables\Actions\DeleteBulkAction::make()
->visible(function($record){
return false;
})
->modalDescription(function($records){
return $records->pluck('name')->join(', ');
})
]);
->bulkActions([
Tables\Actions\DeleteBulkAction::make()
->visible(function($record){
return false;
})
->modalDescription(function($records){
return $records->pluck('name')->join(', ');
})
]);
An attempt was made to evaluate a closure for [Filament\Tables\Actions\DeleteBulkAction], but [$record] was unresolvable.
toeknee
toeknee4w ago
It's a bulk action, so '$records'
mile4841
mile48414w ago
Thanka brother Thanks
Want results from more Discord servers?
Add your server