Skip to content
New issue

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

Is there a $role->hasPermissionTo ? #24

Closed
billbostick opened this issue Dec 14, 2015 · 1 comment
Closed

Is there a $role->hasPermissionTo ? #24

billbostick opened this issue Dec 14, 2015 · 1 comment

Comments

@billbostick
Copy link

Thanks for sharing this... it's awesome. I need to obtain a list of permissions granted to a role. It appears that the hasPermissionTo method is for the user model only. Is there a means that I've overlooked to get a list of permissions granted to a role? At the moment, I'm getting by with:

in_array($permission->name, $role->permissions->pluck('name')->all())
@freekmurze
Copy link
Member

$role->permissions is indeed the easiest way to get the permissions of a role.

A function to get the names of all permissions of a role could be handy. The usage of pluck in your example seems fine. I'd accept a PR that adds this to the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants