updateService = $updateService; } /** * @param Request $request * @return array */ public function index(Request $request): array { return $this->fractal->item($request->user()) ->transformWith($this->getTransformer(AccountTransformer::class)) ->toArray(); } /** * Update the authenticated user's email address if their password matches. * * @param UpdateEmailRequest $request * @return array * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function updateEmail(UpdateEmailRequest $request): array { $updated = $this->updateService->handle($request->user(), [ 'email' => $request->input('email'), ]); return $this->fractal->item($updated->get('model')) ->transformWith($this->getTransformer(AccountTransformer::class)) ->toArray(); } }