can() method with multiple guards doesn't work #2760
Unanswered
Vasiliy-Makogon
asked this question in
Q&A
Replies: 1 comment 3 replies
-
Current version is v6.10.0 var_dump(Auth::guard()->user()->can('editor', 'api')); // try this change
var_dump(Auth::guard()->user()->checkPermissionTo('editor', 'api')); // ok - true |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Version 3.18.0 is installed. Several guards:
A middleware is declared:
This code returns an incorrect value for the
can
method:But if I add this method to the User model:
then everything works:
Question: how can I fix the situation and NOT USE the getDefaultGuardName method in the User model?
Beta Was this translation helpful? Give feedback.
All reactions