Spatie User Roles

use Spatie\Permission\Traits\HasRoles; 

This is the trait need to use

  1. syncRole 
  2. hasRole  



Usage:

$user = JwtAuth::user();

        if ($user->hasRole('manager')) {
            $user->syncRoles([]);
        }

        $user->assignRole('user');

Comments

Popular posts from this blog

useCallback hook in React

Enhance existing Laravel CRUD application with advanced search and filtering capabilities.

VS code shortcut