Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filamentβ€’3y agoβ€’
8 replies
Husky110

Filter gets applied automatically?

Hey again - sorry if my questions are a bit noob-like, I just try to get filament figured out... πŸ™‚
This time I have a weird behaviour. I want to show some articles in my table. For that my table actually uses a morphed-model which has an "article"-relationship.
What I want: Show only articles where article.is_locked = 0 and make articles with article.is_locked = 1 only visible if a filter is active.
I got so far to build a filter like this:
Tables\Filters\Filter::make('article.is_locked')
                    ->query(function (Builder $query){
                        $query->whereHas('article', function ($subquery){
                            $subquery->where('is_locked', 1);
                        });
                    })
                    ->label(__('articles.list.filters.is_locked'))
                    ->toggle()
Tables\Filters\Filter::make('article.is_locked')
                    ->query(function (Builder $query){
                        $query->whereHas('article', function ($subquery){
                            $subquery->where('is_locked', 1);
                        });
                    })
                    ->label(__('articles.list.filters.is_locked'))
                    ->toggle()

But this filter seems to get applied automatically, so right now I only see locked articles even tho the filter is not active.
My two questions here are: Is this normal an intended? And secondly - I am sure I am missing something here, but I need help figuring out what exactly.
Thanks. πŸ™‚
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

Custom Table Filter and Applied filters?
FilamentFFilament / β“β”Šhelp
3y ago
Filter does not work automatically
FilamentFFilament / β“β”Šhelp
2y ago
how to hide table records until a filter is applied?
FilamentFFilament / β“β”Šhelp
2y ago
Filter
FilamentFFilament / β“β”Šhelp
2y ago