Im trying to get a result from a database, what I want to do is get a sum of a curton field then group the results then order by. Heres what I have, but it keeps giving me an error. The error im getting is:
Call to a member function orderBy() on double in
Heres my code:
$app->place->where('week_no', $week)->where('win_lose', 'win')->groupBy('username')->sum('number')->orderBy('number', 'ASC')->get();
Any help is much appreciated. Thanks