Check to see if role has certain permissions
Hopefully I won't sound too vague in this issue. Is there any possible way to get a true or false value when checking if a permission is attached to a certain role? So far I've been unable to.
The use case is that I'm listing all roles in a table, and then all the permissions, and then showing a check box for each per on each role per permission. I have it setup correctly in blade, the issue I've ran into is that I haven't been able to get the default value of the checkbox.
For users that have roles, I just did something like this in a loop: $user->hasRole($role->name)
But I've been unable to find something similar for permissions (something like hasPerm or something), other than the 'perm' method, but I can't get it to return a true of false value. Is there any possible way to get a true or false value when checking permissions against a role without users?
Just created a pull PR for this issue PR #323. Hopefully it's found useful enough to merge.
Wasn't the ability function enough for this? I imagine that calling it with a single value for the second argument would have done the trick.
The problem I saw was that ability still only checked against the user. I didn't need to check against the user per say, I needed to get an overview of what permissions exist against just the roles themselves.
Ah, I assumed you had a list of users based on your $user->hasRole($role->name) example
This issue was merged into the master branch.