Skip to content
Icon

WARNING You're browsing the documentation for an upcoming version of Laravel Acl. The documentation and features of this release are subject to change.

Permission Role

The bundled Permission model has easy to use methods to manage and assign roles.

attachRole($role)

Attach the given role to permission.

$permission = Permission::find(1);
 
return $permission->attachRole(Role::find(1));

attachRoleBySlug($slug)

Attach the given role slug to permission.

$permission = Permission::find(1);
 
return $permission->attachRoleBySlug('admin');

revokeRole($role)

Revoke the given permission role.

$permission = Permission::find(1);
 
return $permission->revokeRole(Role::find(1));

revokeRoleBySlug($slug)

Revoke the given permission role by slug.

$permission = Permission::find(1);
 
return $permission->revokeRoleBySlug('admin');

revokeAllRoles()

Revoke the all permission roles.

$permission = Permission::find(1);
 
return $permission->revokeAllRoles();

syncRoles($roles)

Sync permission roles.

$permission = Permission::find(1);
 
return $permission->syncRoles([1]);