Help: how does the order of where() clauses affect queries? #12737
-
|
Hi, These two variants give entirely different results: the first returns all published entries across collections, not filtering by languages. The second works as expected (show only languages that are published). Am I missing something here? $entries = Entry::query()
->whereStatus('published')
->where('collection', 'languages')
->get();
$entries = Entry::query()
->where('collection', 'languages')
->whereStatus('published')
->get(); |
Beta Was this translation helpful? Give feedback.
Answered by
jasonvarga
Oct 14, 2025
Replies: 1 comment 2 replies
-
|
Maybe we can make it throw an exception if you call it in the wrong order. Done in #12744 |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
mgussekloo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
whereStatusadds subqueries based on what collections are being queried. It needs to know what collections you want first.Maybe we can make it throw an exception if you call it in the wrong order. Done in #12744