Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

Pesquisando e filtrando/refinando resultados de banco de dados em Laravel 4

$houses = new House;

if(Input::get('name'))
    $houses->where('name', '=', Input::get('name'));

if(Input::get('hasCoffeeMachine'))
    $houses->where('hasCoffeeMachine', '=', Input::get('hasCoffeeMachine'));

// Keep adding more for every filter you have

// Don't do this till you are done adding filters.
$houses = $houses->get();