Laravel query builder should have a groupByWhere function to #40748
Unanswered
azankorejo
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've come across a problem even though there are other ways to achieve what I want but there is no straight forward way in my knowledge to accomplish something like
groupByWhere
as the name suggest the first argument should be the field and the second would be callback where a condition would be passed like eg:Model::latest()->groupByWhere('email', function($q) { $q->email !== '[email protected]'; })->get()
I agree the example given is not a good one but you get the point, there should be this function where I can simply groupBy some result and leave others off.
Let me know about your thoughts and if the general consensus is that it should be added then I'll create a PR.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions