How to edit delete bulk action

Hi is it possible when it is selected one record that in mine modalDescription write delete this use with name... and when is selected more to write do you wan to delete this users
Solution:
You can adjust the modal description via ->modalDescription(). Like
->modalDescription(fn ($records) => 'Delete this users: '.$users->pluck('name')->join(', '))
->modalDescription(fn ($records) => 'Delete this users: '.$users->pluck('name')->join(', '))
...
Jump to solution
4 Replies
Solution
Dennis Koch
Dennis Koch4mo ago
You can adjust the modal description via ->modalDescription(). Like
->modalDescription(fn ($records) => 'Delete this users: '.$users->pluck('name')->join(', '))
->modalDescription(fn ($records) => 'Delete this users: '.$users->pluck('name')->join(', '))
mile4841
mile4841OP4mo ago
That solution does not works for me $users name is empty i am using these code
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make()
->modalDescription(function($records){
dd($records);
return $records->pluck('name')->join(', ');
})
->modalDescription(fn ($records) => 'Delete this users: '.$records->pluck('name')->join(', '))
]),
]);
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make()
->modalDescription(function($records){
dd($records);
return $records->pluck('name')->join(', ');
})
->modalDescription(fn ($records) => 'Delete this users: '.$records->pluck('name')->join(', '))
]),
]);
Dennis Koch
Dennis Koch4mo ago
Does your model have a name column? What's the content of $records? Maybe they aren't available in ->modalDescription()
mile4841
mile4841OP4mo ago
I did it, this is the code that works for me, first time i apply on the wrong resource
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make()
->modalDescription(function($records){
return $records->pluck('title')->join(', ');
})
]),
]);
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make()
->modalDescription(function($records){
return $records->pluck('title')->join(', ');
})
]),
]);
Want results from more Discord servers?
Add your server