Reputation: 4525
I want to grab all users from a database, except 2.
I used to grab all except one with this code:
$users = User::where('name', '!=','name1')->get();
but I'm unsure how to add an additional name to this.
Many thanks,
Mike
Upvotes: 2
Views: 38
Reputation: 467
You can use WhereNotIn
$users = User::whereNotIn('name', ['name1', 'name2', 'name3'])->get();
Hope this help you.
Upvotes: 5