Laravel JWT Auth 在登录时获取用户
有没有可能用 https://github.com/tymondesigns/jwt-auth 得到?因为现在我只能生成一个令牌(当用户登录时)。current user
public function login(Request $request)
{
$credentials = $request->only('email', 'password');
try {
if (! $token = JWTAuth::attempt($credentials)) {
return response()->json(['error' => 'invalid_credentials'], 401);
}
} catch (Tymon\JWTAuth\Exceptions\JWTException $e) {
return response()->json(['error' => 'could_not_create_token'], 500);
}
return response()->json(compact('token'));
}