return users according to user role laravel spatie code example
Example 1: get users of specific role laravel role spatie
$users = User::role('writer')->get();
Example 2: get users other than specific role laravel role spatie
User::query()->whereHas("roles", function($q){ $q->whereNotIn("name", ["superadmin"]); })