Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filamentβ€’2y agoβ€’
7 replies
Adam Holmes

Query string in pagination

Hi,

From an edit resource I have a button that links to another list (Audits) resource with 2 parameters like so:

Actions\Action::make(name: 'Audit Logs')
  ->url(function() {
      return route('filament.app.resources.audit-logs.index', ['resource' => ListItemResource::getModel(), 'id' => $this->record->id]);
  }),
Actions\Action::make(name: 'Audit Logs')
  ->url(function() {
      return route('filament.app.resources.audit-logs.index', ['resource' => ListItemResource::getModel(), 'id' => $this->record->id]);
  }),


In my audit list resource I then filter all the audits (this is a polymorphic table and stores the model class name and the model id - note that this is using Laravel Auditing - https://laravel-auditing.com/) based on the 2 GET parameters that are passed like so:

return $table
  ->modifyQueryUsing(function (Builder $query) {
      $query->where('auditable_type', request()->get('resource'));
      $query->where('auditable_id', request()->get('id'));
  })
return $table
  ->modifyQueryUsing(function (Builder $query) {
      $query->where('auditable_type', request()->get('resource'));
      $query->where('auditable_id', request()->get('id'));
  })


Which all works fine on the first load. However, when I change the pagination my request object is reset to null and therefore the above query no longer works.

With Laravel you can do
::paginate()->withQueryString()
::paginate()->withQueryString()
but I can't find anything similar with Filament.

Any ideas to ensure that the request object sticks around, or a better solution to this problem that requires no sending of things in the request?

Thanks πŸ™‚
Laravel Auditing
Laravel Auditing
Laravel Auditing allows you to record changes to an Eloquent model's set of data by simply adding its trait to your model.
Laravel Auditing
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel β€’ Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Route query string values don't persist with pagination in Table
FilamentFFilament / β“β”Šhelp
14mo ago
Query string null in a relationmanager
FilamentFFilament / β“β”Šhelp
14mo ago
Enabling filter query string
FilamentFFilament / β“β”Šhelp
3y ago
Pagination in header
FilamentFFilament / β“β”Šhelp
10mo ago