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

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

报告相同问题?

悬赏问题

  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据