- A query builder whereraw tutorial
whereRaw($sql, array $bindings = [], $boolean = 'and')
A couple of examples:
$g = TableName::whereRaw('LOWER(worker_location) = ? and LOWER(worker_full_name)=?', [$location, $name])->get();
DB::table('tasks') ->select('name', 'details') ->whereRaw('name = :name_placeholder', ['name_placeholder' => $name]) ->whereRaw('id = :id_placeholder', ['id_placeholder' => $id], 'or') ->get();
Multiple parameters:
$sql='LOWER(location) = ? and LOWER(full_name)= ?'; $values=['somewhere', 'name']; $results = TableName::whereRaw($sql, $values)->get();