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
bulkAction?
Tanuki
TanukiOP2y 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
TanukiOP2y ago
I'll follow your thought and go w/ bulkAction for the time beeing
LeandroFerreira
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 Harrin2y ago
try $livewire->getTableRecords() for the current page or $livewire->getFilteredTableQuery()->get() for all
Tanuki
TanukiOP2y ago
Thanks it solved my case
Want results from more Discord servers?
Add your server