© 2026 Hedgehog Software, LLC

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

How to use a parameter to change a resource table query?

I am working with :
FolderResource 
FolderResource 
and
AccessLinkResource
AccessLinkResource
.
An
AccessLink 
AccessLink 
belongs to an
Folder
Folder
. And
Folder
Folder
have many
AccessLinks
AccessLinks
.

I am trying to create a
AccessLinkResource 
AccessLinkResource 
which show and create the records using the
folder_id
folder_id
.

The first step is filter the records of
AccessLinkResource
AccessLinkResource
table using the
folder_id
folder_id
.
To do that, i created a button in
FolderResource
FolderResource
:

 Tables\Actions\ViewAction::make('accessLink'))
                    ->url(fn(Folder $record): string => url(AccessLinkResource::getUrl('index', ['folder_id' => $record->id]))),
 Tables\Actions\ViewAction::make('accessLink'))
                    ->url(fn(Folder $record): string => url(AccessLinkResource::getUrl('index', ['folder_id' => $record->id]))),


And i used the
modifyQueryUsing 
modifyQueryUsing 
in
AccessLink
AccessLink
table:

 ->modifyQueryUsing(function (Builder $query) {
                $folderId = Request::query('folder_id');
                $query->where('folder_id', $folderId);
            });
 ->modifyQueryUsing(function (Builder $query) {
                $folderId = Request::query('folder_id');
                $query->where('folder_id', $folderId);
            });

It works in the first load of the page, but when use the pagination return no records.
What it is the correct way to handle this? How can I use the $folder_id param in a static method?
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

How to override list resource table query?
FilamentFFilament / ❓┊help
2y ago
How to update form query after livewire parameter change
FilamentFFilament / ❓┊help
3y ago
How to change table query to get computed values?
FilamentFFilament / ❓┊help
3y ago
How add a query to the table
FilamentFFilament / ❓┊help
13mo ago