Laravel - Query Builder - Orderby

The orderBy method allows you to sort the results of the query by a given column. The first argument accepted by the orderBy method should be the column you wish to sort by, while the second argument determines the direction of the sort and may be either asc or desc:

    
    $users = DB::table('users')
                    ->orderBy('name', 'desc')
                    ->get();
	

To sort by multiple columns, you may simply invoke orderBy as many times as necessary:

    
    $users = DB::table('users')
                    ->orderBy('name', 'desc')
                    ->orderBy('email', 'asc')
                    ->get();