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

[Feature] Add hasPermissionTo to Roles model #31

Closed
mgambati opened this issue Jan 2, 2016 · 3 comments
Closed

[Feature] Add hasPermissionTo to Roles model #31

mgambati opened this issue Jan 2, 2016 · 3 comments

Comments

@mgambati
Copy link

mgambati commented Jan 2, 2016

It will be very useful when dealing with many roles and permissions.

I would write it, but my testing skills is not good enough to make a PR.

@freekmurze
Copy link
Member

My thinking is that you it's better to check the permissions of a user, instead of checking the permissions of a role.

The only time you might want to retrieve the permissions is when builiding a screen to administer the permissions of a role. But then you could just loop through the permission relation on role.

@jpmurray
Copy link

@freekmurze : just curious, what makes looping through it more of a better option then $role->permissions()->sync($array_for_permissions_id); ?

@freekmurze
Copy link
Member

If you want to save using sync is indeed the best option. In the example above I was thinking about rendering a list.

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

3 participants