withCount(['eggs', 'servers']); return $this->view->make('admin.nests.index', [ 'nests' => $nests, ]); } /** * Render nest creation page. */ public function create(): View { return $this->view->make('admin.nests.new'); } /** * Handle the storage of a new nest. * * @throws \Pterodactyl\Exceptions\Model\DataValidationException */ public function store(StoreNestFormRequest $request): RedirectResponse { $nest = $this->nestCreationService->handle($request->normalize()); $this->alert->success(trans('admin/nests.notices.created', ['name' => $nest->name]))->flash(); return redirect()->route('admin.nests.view', $nest->id); } /** * Return details about a nest including all the eggs and servers per egg. * */ public function view(int $nest): View { return $this->view->make('admin.nests.view', [ 'nest' => Nest::with('eggs.servers')->findOrFail($nest), ]); } /** * Handle request to update a nest. * * @throws \Pterodactyl\Exceptions\Model\DataValidationException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function update(StoreNestFormRequest $request, int $nest): RedirectResponse { $this->nestUpdateService->handle($nest, $request->normalize()); $this->alert->success(trans('admin/nests.notices.updated'))->flash(); return redirect()->route('admin.nests.view', $nest); } /** * Handle request to delete a nest. * * @throws \Pterodactyl\Exceptions\Service\HasActiveServersException */ public function destroy(int $nest): RedirectResponse { $this->nestDeletionService->handle($nest); $this->alert->success(trans('admin/nests.notices.deleted'))->flash(); return redirect()->route('admin.nests'); } }