© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
14 replies
HL

Modify SelectFilter query based on another SelectFilters value (Dependent Filters)

I have these 2 filters
( in my app:

                SelectFilter::make('game')
                    ->relationship('games', 'name'),

                SelectFilter::make('server')
                    ->relationship(
                        name: 'servers',
                        titleAttribute: 'abbrevation',
                        modifyQueryUsing: function (Builder $query) {
                            return $query->orderBy('servers.game', 'asc')->orderBy('servers.id', 'asc');
                        }
                    ),
                SelectFilter::make('game')
                    ->relationship('games', 'name'),

                SelectFilter::make('server')
                    ->relationship(
                        name: 'servers',
                        titleAttribute: 'abbrevation',
                        modifyQueryUsing: function (Builder $query) {
                            return $query->orderBy('servers.game', 'asc')->orderBy('servers.id', 'asc');
                        }
                    ),


I want to make the 2nd filter so, that it only queries the servers, which are selected by the first selectFilter, or otherwise show all.
I can do that with custom filters, but is there some out of the box solution for this?
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 change selectfilter options based on another selectfilter?
FilamentFFilament / ❓┊help
3mo ago
Exporter: Modify Query based on Options?
FilamentFFilament / ❓┊help
2y ago
Conditionally modify query based on column visibility
FilamentFFilament / ❓┊help
3y ago
Update table filters based on search query?
FilamentFFilament / ❓┊help
3y ago