mercredi 25 janvier 2017

Laravel where statement

I am new in Laravel. I want to create a search filter using eloquent model. I want to check some columns are equal to some enteries and return the results, but the problem is that if any of the enteries is empty it returns nothing. How to make it to search if other enteries matche and return values even one of the entery is empty.

$result = person::Where('age','>=',$age)
             ->Where('hairColor','=',$hairColor)
             ->Where('height','>=',$height)
             ->get();

Aucun commentaire:

Enregistrer un commentaire