-
Notifications
You must be signed in to change notification settings - Fork 216
Revoke Permissions from Role
Kodeine edited this page Feb 23, 2015
·
1 revision
Similarly, you may revoke permissions from a role
Note: You can pass an object, an array, permission->id or just a name.
$roleAdmin = Role::first(); // administrator
// permission as an object
$roleAdmin->revokePermission($permUser);
// as an id
$roleAdmin->revokePermission($permUser->id);
// or by name
$roleAdmin->revokePermission('user');
Or multiple permissions
at once:
// multiple permissions in an array
$roleAdmin->assignPermission(array($permUser, $permPost->id));
// or mutiple role slugs separated by comma or pipe.
$roleAdmin->assignPermission('user, 'post');
Note: The system will throw an exception if role does not exists.