$user->role = new \AntonioPrimera\BasicPermissions\Role('store-admin');
$user->save();
if ($user->hasPermission('store:manage'))
//do something
//provide the list of permissions as an array
if ($user->hasAllPermissions(['store:manage', 'items:move', 'items:sell']))
//do something only if the actor has all the above permissions
//OR
//provide the list of permissions as separate arguments
if ($user->hasAllPermissions('store:manage', 'items:move', 'items:sell'))
//do something only if the actor has all the above permissions
//provide the list of permissions as an array
if ($user->hasAnyPermission(['store:manage', 'items:move', 'items:sell']))
//do something if the actor has at least one of the above permissions
//OR
//provide the list of permissions as separate arguments
if ($user->hasAnyPermission('store:manage', 'items:move', 'items:sell'))
//do something if the actor has at least one of the above permissions
'store-admin' => [
'label' => [
'en' => 'Store Admin',
'es' => 'Administrador de Tienda',
],
//...other role attributes
],
'store:manage' => [
'description' => [
'en' => 'Allows the user to manage the store',
'es' => 'Permite al usuario administrar la tienda',
],
//...other permission attributes
],
(string) $role; //returns the role label, or the role name if no label is provided
//in a blade file:
{{ $role }} //returns the role label, or the role name if no label is provided