mercredi 18 janvier 2017

How to check multiple columns?

I have a problem because when i have in variable $name = "firstname lastname", i got nothing, but if i enter only firstname or only lastname i get result. I want to check both columns so when user enter firstname lastname that gets user with firstname lastname. Any suggestion? I have this query:

$q->orWhere('first_name','like','%' .$name . '%')->orWhere('last_name','like','%' . $name . '%');

I tried this with union:

$q->orWhere('first_name','like','%' .$name . '%')->union('last_name','like','%' . $name . '%');

but i get this error:

Call to a member function getBindings() on string



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2iHd7nd
via IFTTT

Aucun commentaire:

Enregistrer un commentaire