Level 73
Scopes is probably your best option for this.
I don't really see a way for this to be dynamic enough otherwise. It all boils down to you needing to dynamically build the query.
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
hi every one, imagine I want to write a query with some where clauses, but some parts of this queriy are repeated in another queries as well, for example where('date', '>' , $date), I dont want to use scope because I have some models to use them and even I dont want to write global scopes, how can I do with this? is it possible to write a repository for this?
Please or to participate in this conversation.