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
where
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
where
status
in ('draft', 'final') and ((
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
Was this page helpful?