laravel spatie model role code example
Example 1: get users of specific role laravel role spatie
$users = User::role('writer')->get();
Example 2: create role spatie
// Create a role or permission if necessary
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;
$role = Role::create(['name' => 'writer']);
$permission = Permission::create(['name' => 'edit articles']);