-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
@can not working as expected #13
Comments
Did you register the service provider? |
same issue with me !!! |
@AEK-BKF Did you register the service provider? Which error are you getting? |
I'm not sure if I'm having the same trouble, but...
Works fine.For the current user, But trying to do
Any idea? EDIT: yes, everyting looks fine in the database. and I do have the service provider registered. |
I solved my issue by editing hasRole & PermissionServiceProvider classes like this :
registerBladeExtensions in PermissionServiceProvider class : And all is working fine , I can use this : @Permission('Add-User') it works :)) |
I'll wait for @freekmurze input on that before messing with the package files ;-) |
Welp, shame on me. My issue is basically related to me not scrolling enough in my files. I just found a old stray "permissions" function in my User model. Now that it's gone, everything works fine :/ |
@jpmurray nice, I'm glad you found the solution quickly 👍 |
@freekmurze although are the permissions functions ( Curently trying to do a (EDIT: I'm actually trying to have an interface update a role, I think I'll try Laravel's (EDIT 2 : And of course, |
No, see #31 On Sunday, 10 January 2016, Jean-Philippe Murray [email protected]
Freek Van der Herten |
What is the final answer? |
add this to the AuthServiceProvider.php file and you can then use @can ??? I dont know wat @freekmurze will suggest, but even after registering the service provider class in app.php, @can doesnt work. Well i dnt know whether to mess thecode or try it like @AEK-BKF did. the only problems you can face is when assigning multiple roles andmultiple permissions. I think that multiple permissions can be assigned to a role, but users should be only given the role and then the role must check whether the user is assigned the role and it has certain permissions on it. |
Normally if you the service provider is registered correctly, the package will register all permissions at the gate. This package has tests to prove that the provided functionality is working. If you are still having problem, could you please submit a failing test? That would help me immensely in finding the problem/solution. |
it was just a suggestion to above user, for me this package is working perfectly except @can is not working in blade templates and my testing is little poor, so cnt help you out much, lots of usage coming across the way. I had jut one simple question, i had done something from the scratch , and was able to relate all the users roles and permission, and assigning the roles the permissions, and fetching, revoking and updating the roles and permission. But i am still figuring how will i use the middleware to check the role of the user and then redirect to following path , and also the routes should be served to that roles only. I have tried your another package, n thats works perfectly for me, but if you can help me from scratch. But this should be more normalised and i dnt want to mess with the authcontroller file, any help/hint would be good for me? |
I know this issue was closed, but I'm still running into the same issue. I've registered the service provider. can() returns false even though the user has the permission through the role(s) assigned. |
Could you PR a failing test? |
Hi there,
I upgraded from version 5.1. following http://laravel.com/docs/5.1/upgrade#upgrade-5.1.11
Everything seems to work but $user->can('create post') is false when $user->hasPermissionTo('create post') is true... What I'm missing?
Thanks!
The text was updated successfully, but these errors were encountered: