Spatie User Roles
use Spatie\Permission\Traits\HasRoles;
This is the trait need to use
- syncRole
- hasRole
Usage:
$user = JwtAuth::user();
if ($user->hasRole('manager')) {
$user->syncRoles([]);
}
$user->assignRole('user');
Comments
Post a Comment
What is your thought about this?