alert = $alert; $this->updateService = $updateService; } /** * Display base account information page. * * @return \Illuminate\View\View */ public function index() { return view('base.account', [ 'languages' => $this->getAvailableLanguages(true), ]); } /** * Update details for a user's account. * * @param \Pterodactyl\Http\Requests\Base\AccountDataFormRequest $request * @return \Illuminate\Http\RedirectResponse * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException */ public function update(AccountDataFormRequest $request) { $data = []; if ($request->input('do_action') === 'password') { $data['password'] = $request->input('new_password'); } elseif ($request->input('do_action') === 'email') { $data['email'] = $request->input('new_email'); } elseif ($request->input('do_action') === 'identity') { $data = $request->only(['name_first', 'name_last', 'username', 'language']); } $this->updateService->setUserLevel(User::USER_LEVEL_USER); $this->updateService->handle($request->user(), $data); $this->alert->success(trans('base.account.details_updated'))->flash(); return redirect()->route('account'); } }