In an API, I'm using laravel basic auth. To get details of the user, I need to pass the ID of the user into the request. Is it possible to get details of the user using, authenticated with laravel basic auth?
2条回答 默认 最新
- douyaju4259 2018-08-11 07:49关注
You can get user id whenever User is logged in by :
auth()->id();
or
Auth::user()->id();
FYI: you don't have to send User info in any request you can retrieve his/her basic info from the helper method
auth()
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报