duanbanzhi4419 2018-08-11 07:05
浏览 469
已采纳

Laravel Basic Auth-获取用户详细信息

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()

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?