alert->warning(trans('admin/server.alerts.node_required'))->flash(); return redirect()->route('admin.nodes'); } $nests = $this->nestRepository->getWithEggs(); JavaScript::put([ 'nodeData' => $this->nodeRepository->getNodesForServerCreation(), 'nests' => $nests->map(function ($item) { return array_merge($item->toArray(), [ 'eggs' => $item->eggs->keyBy('id')->toArray(), ]); })->keyBy('id'), ]); return $this->view->make('admin.servers.new', [ 'locations' => Location::all(), 'nests' => $nests, ]); } /** * Create a new server on the remote system. * * @throws \Illuminate\Validation\ValidationException * @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableAllocationException * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException * @throws \Throwable */ public function store(ServerFormRequest $request): RedirectResponse { $data = $request->except(['_token']); if (!empty($data['custom_image'])) { $data['image'] = $data['custom_image']; unset($data['custom_image']); } $server = $this->creationService->handle($data); $this->alert->success(trans('admin/server.alerts.server_created'))->flash(); return new RedirectResponse('/admin/servers/view/' . $server->id); } }