Cannot check roles from auth()->user(). Only with User::find #2734
Unanswered
HeapReaper
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, so i've an default user. I've assigned the role
management
to it.Now i do have the trait in the user model.
Now i wanna use an blade directive.
Tho i noticed that
@hasRole('management')
doesnt get triggered.So i digged, and noticed that:
dd(Auth()->user()->hasRole('management'));
returns falseand:
dd(User::find(Auth()->user()->id)->hasRole('management'));
returns true.Why is this?
Beta Was this translation helpful? Give feedback.
All reactions