call([$this, 'loadDependencies']); // Parse all of the includes to use on this request. $input = $this->request->input('include', []); $input = is_array($input) ? $input : explode(',', $input); $includes = (new Collection($input))->map(function ($value) { return trim($value); })->filter()->toArray(); $this->fractal->parseIncludes($includes); $this->fractal->limitRecursion(2); } /** * Perform dependency injection of certain classes needed for core functionality * without littering the constructors of classes that extend this abstract. */ public function loadDependencies(Fractal $fractal, Request $request) { $this->fractal = $fractal; $this->request = $request; } /** * Return an instance of an application transformer. * * @return \Pterodactyl\Transformers\Api\Application\BaseTransformer * * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function getTransformer(string $abstract) { /** @var \Pterodactyl\Transformers\Api\Application\BaseTransformer $transformer */ $transformer = Container::getInstance()->make($abstract); $apiKey = $this->request->attributes->get('api_key'); $transformer->setKey($this->request->attributes->get('api_key')); $transformer->setRootAdmin($this->request->user()->root_admin); Assert::isInstanceOf($transformer, BaseTransformer::class); return $transformer; } /** * Return a HTTP/204 response for the API. */ protected function returnNoContent(): Response { return new Response('', Response::HTTP_NO_CONTENT); } }