-
Notifications
You must be signed in to change notification settings - Fork 216
Revoke Roles From User
Kodeine edited this page Feb 23, 2015
·
1 revision
Similarly, you may revoke roles from user
Note: You can pass an object, an array, role->id or just a slug.
$user = User::find(1);
// by object
$user->revokeRole($roleAdmin);
// or by id
$user->revokeRole($roleAdmin->id);
// or by just a slug
$user->revokeRole('administrator');
Or multiple roles
at once:
// multiple roles in an array
$user->revokeRole(array($roleAdmin, $roleModerator));
// or mutiple role slugs separated by comma or pipe.
$user->revokeRole('administrator, moderator');
Note: The system will throw an exception if role does not exists.