We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to test if user has one or more roles ? Example: There is 3 roles: admin, support, staff User A is assigned for roles admin
If I want to know if user A has roles admin or staff.
Trying to use hasAnyRoles but no luck
Is this bug ?
When hasAnyRole('admin','staff') will return true When hasAnyRole('staff','admin') will return false
Thanks
The text was updated successfully, but these errors were encountered:
The hasAnyRole() method except only string, Collection object or Role Model as $roles argument.
hasAnyRole()
string
Collection
Role
$roles
Is it a bug ? Yes.
You can check the source code https://github.com/spatie/laravel-permission/blob/master/src/Traits/HasRoles.php#L70.
Sorry, something went wrong.
This is indeed a bug, and I'm working on a fix. Thanks for letting me know.
Fixed in version 1.3.4
No branches or pull requests
How to test if user has one or more roles ?
Example:
There is 3 roles: admin, support, staff
User A is assigned for roles admin
If I want to know if user A has roles admin or staff.
Trying to use hasAnyRoles but no luck
Is this bug ?
When hasAnyRole('admin','staff') will return true
When hasAnyRole('staff','admin') will return false
Thanks
The text was updated successfully, but these errors were encountered: