#Accessing the selected records before firing a bulk action
6 messages · Page 1 of 1 (latest)
Hi, you could do this for example with a custom BulkAction:
BulkAction::make('bulkEdit')
->name('My action')
->icon('heroicon-o-pencil')
->form([
Select::make('a_select_field')
])
->action(function (Collection $records, array $data) {
$data = array_filter($data);
return $records->each->update($data);
})
->deselectRecordsAfterCompletion(),
You also have the before() method:
Tables\Actions\DeleteBulkAction::make()
->before(function (Collection $records) {
// ...
})
actually i want to access the selected records before i click the action, before is not working until i click the the bulk action
oh gotcha
Is this possible, to access the selected records before clicking the bulk action?