jeudi 4 mai 2017

Laravel 5.0 whereRaw concat like

I am using Laravel 5.0.

I have this:

return User::whereRaw("CONCAT(first_name, ' ', last_name) LIKE '%?%'", ['test'])->get();

and it returns [].

When i change it to:

return User::whereRaw("CONCAT(first_name, ' ', last_name) LIKE '%test%'")->get();

it returns an array with 3 users.

I can't figure out what I am doing wrong.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire