authService->login(AuthDto::fromRequest($request)); if (!$tokens) { return $this->errorResponse(message: __('auth.failed'), code: 401); } return $this->successResponse(payload: new AuthResource($tokens), message: __('auth.logged_in')); } public function logout(): JsonResponse { $this->authService->logout(); return $this->successResponse(message: __('auth.logout')); } public function refresh(RefreshTokenRequest $request): JsonResponse { $tokens = $this->authService->refresh(RefreshTokenDto::fromRequest($request)); if (is_null($tokens)) { return $this->errorResponse(message: __('auth.unauthorized'), code: 403); } return $this->successResponse(payload: new AuthResource($tokens)); } }