Laravel - Query Builder - Whereraw Orwhereraw
The whereRaw
and orWhereRaw
methods can be used to inject a raw "where" clause into your query. These methods accept an optional array of bindings as their second argument:
$orders = DB::table('orders')
->whereRaw('price > IF(state = "TX", ?, 100)', [200])
->get();