© 2026 Hedgehog Software, LLC

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

OrWhere creates AND in Filter

I am experiencing a very strange behavior when creating an OR-query on a Filter.
I have a DocumentResource - by default I only want to show the documents with the status "draft" and "final". With the Filter I also want to show the documents with status "archive". So i provided this which returns the following query.

parent::getEloquentQuery()->visible(); // select count() as aggregate from
documents
documents
where
status
status
in ('draft', 'final')

So far so good. In the Filter i provided this:

->query(fn (Builder $query): Builder => $query->orWhere->archived()

which strangely does not create an OR condition as expected but instead creates this AND condition:

select count(
) as aggregate from
documents
documents
where
status
status
in ('draft', 'final') and ((
status
status
= 'archive'))

I tried all the variations of orWhere() and also used the scopes in a normal Controller Action and it worked totally as expected.

So what is happening here, when providing the
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

Json OrWhere with other Filters ?
FilamentFFilament / ❓┊help
3y ago
Eloquent orWhere question
FilamentFFilament / ❓┊help
2y ago
Nested filters and filterTable() testing
FilamentFFilament / ❓┊help
3y ago
Custom Table Filter and Applied filters?
FilamentFFilament / ❓┊help
3y ago