F
Filamentβ€’3w ago
bachir

dd($record) always returns the first record, no matter which one I select

Hi everyone πŸ‘‹ I'm having a strange issue in my Filament admin panel. When I try to dump the selected record inside a table action using dd($record), it always returns the first record of the table β€” no matter which record I actually click on. Here's what I'm doing:
Tables\Actions\Action::make('View')
->label('View')
->action(function ($record) {
dd($record);
}),
Tables\Actions\Action::make('View')
->label('View')
->action(function ($record) {
dd($record);
}),
But it always dumps the same record (the first one).
2 Replies
stefket
stefketβ€’3w ago
Sounds like you might be trying to create a bulk action β€” in that case, you should use the BulkAction class instead of Action. Docs: v4 β†’ https://filamentphp.com/docs/4.x/tables/actions#bulk-actions v3 β†’ https://filamentphp.com/docs/3.x/tables/actions#bulk-actions
stefket
stefketβ€’3w ago
Or are you really talking about record actions? I just thought that because you mentioned selected records.

Did you find this page helpful?