F
Filament2mo ago
Asmit

Help: Table toolbarActions/headerActions - record() not accessible in action callback

Hey Everyone! 👋 I'm having an issue with table actions where explicitly set records aren't accessible in the action callback. Problem: When I set a record explicitly on a toolbarAction or headerAction using ->record(), the record parameter in the action callback shows as null. Code Example:
->toolbarActions([
Action::make('test')
->record(fn($record) => Student::first()) // Explicitly setting record
->action(fn($record) => dd($record)), // $record is null here
])
->toolbarActions([
Action::make('test')
->record(fn($record) => Student::first()) // Explicitly setting record
->action(fn($record) => dd($record)), // $record is null here
])
4 Replies
LeandroFerreira
What are you trying to do? I think $record is available for row actions, not toolbar or header actions
Asmit
AsmitOP5w ago
Hi @LeandroFerreira Thanks for the reply I’ve added the table with custom data and a toolbar action. I need to make the action depend on a record, but for now I’m just going with arguments.
LeandroFerreira
depend on a record Wouldn't it be a bulk action?
Asmit
AsmitOP5w ago
Actually, I need to open a modal with that action, and the modal content should be related to the record.

Did you find this page helpful?