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

Top Laravel Security Best Practices: How to Secure Your Web Application 🚀

Restoring Your Data in Xampp: A Step-by-Step Guide

Implement a real-time, interactive map