且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Laravel 5.6-如何在api控制器中获取auth()-> user()或$ response-> user()?

更新时间:2023-11-17 17:51:22

api防护作为参数传递,以获取授权用户,而无需中间件保护请求.

Pass the api guard as a parameter to fetch the authorized user without the middleware protecting the request.

$request->user('api');

// Or

auth('api')->user();