Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

eloquent whereRaw

$orders = DB::table('orders')
                ->whereRaw('price > IF(state = "TX", ?, 100)', [200])
                ->get();

#To use in search
$paciente   = $query->whereRaw("(
        LOWER(name)             like '%". strtolower($search) ."%' OR
        LOWER(sku)              like '%". strtolower($search) ."%' OR
        LOWER(codigo)           like '%". strtolower($search) ."%' OR
        LOWER(descricao_curta)  like '%". strtolower($search) ."%'
    )");
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #eloquent #whereRaw
ADD COMMENT
Topic
Name
5+4 =