Auth::user()->id problem #2808
fatihbarissahan
started this conversation in
General
Replies: 1 comment
-
Try as below
|
Beta Was this translation helpful? Give feedback.
0 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
Hello,
I tried every way but I can't figure it out. I am using Spatie permission plugin and I need to hide some fields based on login user's permissions. Whatever I did, I get an error when I want to get the id of the logged in user. It works when I give the id information myself (example: user with id 1). How can I solve this problem?
Another way:
Here
User::with('roles')->where('id',Auth::id())->first(); in its place
User::with('roles')->where('id',1)->first(); It works normally without any problems.
Beta Was this translation helpful? Give feedback.
All reactions