© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
4 replies
nowak

How to get all table records in header action

I want to add a header action for my admin panel resource table, where I need to send the records to a blade view to create a pdf export.

What is the best way to get a Collection of the current tables records in a header action?
I tried to do this:
->headerActions([
  Action::make('downloadPdf')
    ->label('Download Pdf')
    ->icon('heroicon-o-arrow-down-tray')
    ->action(function (Collection $records, Table $table, Component $livewire) {
      \Log::info('Pdf Export', ['Collection' => $records, 'Table Query' => $table->getQuery(), 'Component' => $livewire]);
    }),
])
->headerActions([
  Action::make('downloadPdf')
    ->label('Download Pdf')
    ->icon('heroicon-o-arrow-down-tray')
    ->action(function (Collection $records, Table $table, Component $livewire) {
      \Log::info('Pdf Export', ['Collection' => $records, 'Table Query' => $table->getQuery(), 'Component' => $livewire]);
    }),
])

But the looks don't show anything useful:
{"Collection":{"Illuminate\\Support\\Collection":[]},"Table Query":{"Illuminate\\Database\\Eloquent\\Builder":[]},"Component":{"App\\Filament\\Resources\\GroupOrderManagementResource\\Pages\\ListGroupOrderManagement":{"mountedActions":[],"mountedActionsArguments":[],"mountedActionsData":[],"defaultAction":null,"defaultActionArguments":null,"componentFileAttachments":[],"mountedFormComponentActions":[],"mountedFormComponentActionsArguments":[],"mountedFormComponentActionsData":[],"mountedFormComponentActionsComponents":[],"mountedInfolistActions":[],"mountedInfolistActionsData":[],"mountedInfolistActionsComponent":null,"mountedInfolistActionsInfolist":null,"isTableReordering":false,"tableFilters":{"status":{"show_declined":false}},"tableGrouping":null,"tableGroupingDirection":null,"tableSearch":"","tableSortColumn":null,"tableSortDirection":null,"activeTab":"dinner","isTableLoaded":false,"tableRecordsPerPage":10,"tableColumnSearches":[],"toggledTableColumns":[],"mountedTableActions":["downloadPdf"],"mountedTableActionsData":[[]],"mountedTableActionsArguments":[[],[]],"mountedTableActionRecord":null,"defaultTableAction":[],"defaultTableActionArguments":[],"defaultTableActionRecord":[],"selectedTableRecords":[],"mountedTableBulkAction":null,"mountedTableBulkActionData":[],"tableDeferredFilters":null,"paginators":{"page":1}}}} 
{"Collection":{"Illuminate\\Support\\Collection":[]},"Table Query":{"Illuminate\\Database\\Eloquent\\Builder":[]},"Component":{"App\\Filament\\Resources\\GroupOrderManagementResource\\Pages\\ListGroupOrderManagement":{"mountedActions":[],"mountedActionsArguments":[],"mountedActionsData":[],"defaultAction":null,"defaultActionArguments":null,"componentFileAttachments":[],"mountedFormComponentActions":[],"mountedFormComponentActionsArguments":[],"mountedFormComponentActionsData":[],"mountedFormComponentActionsComponents":[],"mountedInfolistActions":[],"mountedInfolistActionsData":[],"mountedInfolistActionsComponent":null,"mountedInfolistActionsInfolist":null,"isTableReordering":false,"tableFilters":{"status":{"show_declined":false}},"tableGrouping":null,"tableGroupingDirection":null,"tableSearch":"","tableSortColumn":null,"tableSortDirection":null,"activeTab":"dinner","isTableLoaded":false,"tableRecordsPerPage":10,"tableColumnSearches":[],"toggledTableColumns":[],"mountedTableActions":["downloadPdf"],"mountedTableActionsData":[[]],"mountedTableActionsArguments":[[],[]],"mountedTableActionRecord":null,"defaultTableAction":[],"defaultTableActionArguments":[],"defaultTableActionRecord":[],"selectedTableRecords":[],"mountedTableBulkAction":null,"mountedTableBulkActionData":[],"tableDeferredFilters":null,"paginators":{"page":1}}}} 
Solution
  $livewire->getFilteredTableQuery()->get()
  $livewire->getFilteredTableQuery()->get()

Could be worth a try
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

How to get all options from table filter in table header action?
FilamentFFilament / ❓┊help
17mo ago
Records count in table header
FilamentFFilament / ❓┊help
2y ago
How to get selected record from table in header action?
FilamentFFilament / ❓┊help
3y ago
Only show header action if table has records
FilamentFFilament / ❓┊help
3y ago