what about. $editors = User::whereHas('roles', function($roles) { return $roles->where('name', '=', 'editor'); })->get();
Apr 21, 2016
2
Level 6
Get user with explicit roles
Hi.
Imagine I have two roles: editor and admin
I want to fetch those users which are ONLY editors (admins are editors too).
So, this is what I'm trying, but it fetchs admins too...
$editors = User::whereHas('roles', function($roles) {
return $roles->whereName('editor');
})->get();
What would be the query I'm looking for?
Please or to participate in this conversation.