eggConfigurationService = $eggConfigurationService; $this->repository = $repository; $this->configurationStructureService = $configurationStructureService; } /** * Returns details about the server that allows Wings to self-recover and ensure * that the state of the server matches the Panel at all times. * * @param \Illuminate\Http\Request $request * @param string $uuid * @return \Illuminate\Http\JsonResponse * * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function __invoke(Request $request, $uuid) { $server = $this->repository->getByUuid($uuid); return new JsonResponse([ 'settings' => $this->configurationStructureService->handle($server), 'process_configuration' => $this->eggConfigurationService->handle($server), ]); } /** * Lists all servers with their configurations that are assigned to the requesting node. * * @param \Illuminate\Http\Request $request * @return \Pterodactyl\Http\Resources\Wings\ServerConfigurationCollection */ public function list(Request $request) { /** @var \Pterodactyl\Models\Node $node */ $node = $request->attributes->get('node'); // Avoid run-away N+1 SQL queries by pre-loading the relationships that are used // within each of the services called below. $servers = Server::query()->with('allocations', 'egg', 'mounts', 'variables', 'location') ->where('node_id', $node->id) // If you don't cast this to a string you'll end up with a stringified per_page returned in // the metadata, and then Wings will panic crash as a result. ->paginate((int)$request->input('per_page', 50)); return new ServerConfigurationCollection($servers); } }