public function login(Request $request) { $credentials = $request->only(['email', 'password']); $user = $this->authService->loginWithCredentials($credentials); $encodedToken = $this->tokenService->requestAccessToken($user); $jsonUser = $this->jsonTransformer->item($user, new UserTransformer()); return $this->respondOk(['user' => $jsonUser, 'token' => $encodedToken->toString()]); }