sql >> Base de Datos >  >> RDS >> Mysql

Buscar y filtrar/refinar los resultados de la base de datos en 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();