Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Suchen und Filtern / Verfeinern von Datenbankergebnissen in 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();