viableNodesService = $viableNodesService; } /** * Finds any nodes that are available using the given deployment criteria. This works * similarly to the server creation process, but allows you to pass the deployment object * to this endpoint and get back a list of all Nodes satisfying the requirements. * * @throws \Illuminate\Contracts\Container\BindingResolutionException * @throws \Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException */ public function __invoke(GetDeployableNodesRequest $request): array { $data = $request->validated(); $nodes = $this->viableNodesService->setLocations($data['location_ids'] ?? []) ->setMemory($data['memory']) ->setDisk($data['disk']) ->handle($request->query('per_page'), $request->query('page')); // @phpstan-ignore-line return $this->fractal->collection($nodes) ->transformWith(NodeTransformer::class) ->toArray(); } }