
Mam dwie kolumny:
column_a i column_b
I chciałbym wyciągnąć sumę column_a i column_b i wg tego sortować.
Wyczytałem w necie że można to zrobić tak:
$stats = DB::table('users_stats') ->select(DB::raw('column_a + column_b' as 'total')) ->orderBy('total', 'DESC') ->get();
ale nie działa

Jak rozwiązać to zapytanie?
Mam dla potomnych:)
Kod ma wyglądać tak:
$stats = DB::table('users_stats') ->orderByRaw('column_a + column_b DESC') ->get();