unexpected result from auth()->user()->can('[permission-name]') #2473
-
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Refresh spatie cache, check guard_name |
Beta Was this translation helpful? Give feedback.
-
So, like @parallels999 said, clearing the cache and inspecting your guards is a good place to start. Further, you can replace |
Beta Was this translation helpful? Give feedback.
-
If I check all permission given to users through direct permissions. "can and hasPermissionTo" works fine |
Beta Was this translation helpful? Give feedback.
You can see here that the
hasPermissionTo()
function checks both direct permissions and permissions via roles:laravel-permission/src/Traits/HasPermissions.php
Lines 225 to 234 in 2cc68fd
And calling
can
call…