deletionService = $deletionService; $this->fractal = $fractal; $this->repository = $repository; } /** * Return all of the allocations that exist for a given node. * * @param \Pterodactyl\Http\Requests\Api\Application\Allocations\GetAllocationsRequest $request * @param \Pterodactyl\Models\Node $node * @return array */ public function index(GetAllocationsRequest $request, Node $node): array { $allocations = $this->repository->getPaginatedAllocationsForNode($node->id, 100); return $this->fractal->collection($allocations) ->transformWith((new AllocationTransformer)->setKey($request->key())) ->withResourceName('allocation') ->paginateWith(new IlluminatePaginatorAdapter($allocations)) ->toArray(); } /** * Delete a specific allocation from the Panel. * * @param \Pterodactyl\Http\Requests\Api\Application\Allocations\DeleteAllocationRequestApplication $request * @param \Pterodactyl\Models\Node $node * @param \Pterodactyl\Models\Allocation $allocation * @return \Illuminate\Http\Response * * @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException */ public function delete(DeleteAllocationRequestApplication $request, Node $node, Allocation $allocation): Response { $this->deletionService->handle($allocation); return response('', 204); } }