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?

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

You can get the current user in your controller by injecting the Illuminate\Http\Request object in to the method.

e.g.

public function profile(Request $request) {
    $user = $request->user();
    // do something