Laravel - Query Builder - Groupbyraw

The groupByRaw method may be used to provide a raw string as the value of the group by clause:

    
    $orders = DB::table('orders')
                    ->select('city', 'state')
                    ->groupByRaw('city, state')
                    ->get();