lets say that i have user table that has many users in it. I want to get all users but not the auth user. How can i do that in a simple query?, i tried:
$users = User::whereNotIn('id',auth()->user()->id)->get();
But it didn't work. Any help please? and sorry for this simple question.
In
and NotIn
need an array as second args
$users = User::whereNotIn('id',[auth()->id()])->get();
for more : https://laravel.com/docs/8.x/collections#method-wherenotin
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments