Skip to content
Icon

WARNING You're browsing the documentation for an old version of LARAVEL-ACL. Consider upgrading your project to laravel-acl 10.0.

Usage

Laravel ACL package comes bundled with a HasRole file to be used within your User model file. This trait file provides all the necessary functions to tie your users in with roles and permissions.

Example User Model

<?php
 
namespace App;
 
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Yajra\Acl\Traits\HasRole;
 
class User extends Authenticatable
{
use Notifiable;
use HasRole;
 
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'gender', 'email', 'password',
];
 
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password',
'remember_token',
];
}