© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•13mo ago•
5 replies
__Dementor

SelectFilter doesn not work like I want

Hello I have a select filter
Tables\Filters\SelectFilter::make('status_filter')
  ->options(JobStatusEnum::asSelectArray())
  ->modifyQueryUsing(function (mixed $state, Builder $query): Builder {
    return $query->where('status', $state);
  }),
Tables\Filters\SelectFilter::make('status_filter')
  ->options(JobStatusEnum::asSelectArray())
  ->modifyQueryUsing(function (mixed $state, Builder $query): Builder {
    return $query->where('status', $state);
  }),

And it's work, but when I not have any selected option I dont have a any record in table. How I can fix them?
Solution
I think you can use
$query->when(..)
$query->when(..)
like this example
Custom filters - Table Builder - Filament
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

SelectFilter doesn't working
FilamentFFilament / ❓┊help
17mo ago
SelectFilter default not working
FilamentFFilament / ❓┊help
16mo ago
Relation with where id check doesnt work like i want it
FilamentFFilament / ❓┊help
3y ago
SelectFilter Not Filtering when Multiple
FilamentFFilament / ❓┊help
2y ago