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