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]);
  }),


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'));
  })


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() 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 allows you to record changes to an Eloquent model's set of data by simply adding its trait to your model.
Was this page helpful?