I use laravel spatie package for user permissions. I need to list all users not belongs to a specific user. For example list all non admin(role) users.
For listing all admin users I used
$users = App\User::role('admin');
I need just opposite to that
Try that way:
return $this->users()->whereHas('roles', function ($query) {
return $query->where('name','!=', 'admin');
})->first();