I’m new in php/laravel.
I’m trying to get one user with the userName of the user connected except if it’s "Chuck NORRIS"
This, is working. I’m getting the user connected information
$oneUser= User::where('name', $userName)->get();
This, is not working. I’m getting the user Chuck NORRIS if he’s the one connected
$oneUser= User::where('name', $userName)->where($userName, '!=', "Chuck NORRIS")->get();
4
Answers
This is what i've done and what is working :
this should work, you check is the $userName is Chuck NORRIS
if not, then run the query
otherwise return back
you can use "whereNot" query like this: