This query is working good. It brings the totals for each city according to groupBy method.
$cities = Washticket::whereDate('used_at', $date)
->get()
->groupBy('place_used.state');
Now I want the list sorted showing up biggest numbers first.
How can I do that?
CodePudding user response:
You can use orderBy
$cities = Washticket::query()
->whereDate('used_at', $date)
->orderBy('place_used.state', 'desc)
->groupBy('place_used.state')
->get();
