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

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

CSS specificity hierarchy