laravel order by on sum amount code example Example: order by sum() laravel Auth::user()->orderByRaw('SUM(points) DESC')->get();