mardi 3 décembre 2019

how to query from 2 column with one string in laravel

i have 2 column in users table first_name & last_name.
i want to query if user search john doe.
i tried like this

$users = User::where('username', $request->text)->orWhere('first_name', 'LIKE', '%' . $request->text . '%')->paginate(5);

its search through only john

i really don't understand how to do it

(Note user can search anything like johndoe or username)

help me thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire