fractal = $fractal; $this->repository = $repository; } public function index(Request $request): array { $servers = $this->repository->paginated(50); return $this->fractal->collection($servers) ->transformWith((new ServerTransformer)->setKey()) ->withResourceName('server') ->toArray(); } }