Laravel - Query Builder - Orderbyraw

The orderByRaw method may be used to provide a raw string as the value of the "order by" clause:

    
    $orders = DB::table('orders')
                    ->orderByRaw('updated_at - created_at DESC')
                    ->get();