F
Filament15mo ago
Tanuki

RelationManagerTable access $records from headeractions

Is there a way to access all of the records within the relation manager from the action itself ?
->headerActions([
Tables\Actions\Action::make('lorem')
->action(fn ($records) => dump($records)),
])
->headerActions([
Tables\Actions\Action::make('lorem')
->action(fn ($records) => dump($records)),
])
6 Replies
LeandroFerreira
LeandroFerreira15mo ago
bulkAction?
Tanuki
Tanuki15mo ago
I wanted to perform the action directly from the header without having to select all records manually. But maybe it isn't user-friendly enough
Tanuki
Tanuki15mo ago
I'll follow your thought and go w/ bulkAction for the time beeing
LeandroFerreira
LeandroFerreira15mo ago
not sure if it is the right way, but you could do this
->action(function ($livewire) {
$livewire->ownerRecord->your_relationship
})
->action(function ($livewire) {
$livewire->ownerRecord->your_relationship
})
https://filamentphp.com/docs/2.x/admin/resources/relation-managers#accessing-the-owner-record
Filament
Relation managers - Resources - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
Dan Harrin
Dan Harrin15mo ago
try $livewire->getTableRecords() for the current page or $livewire->getFilteredTableQuery()->get() for all
Tanuki
Tanuki15mo ago
Thanks it solved my case
Want results from more Discord servers?
Add your server
More Posts