assignmentService = $assignmentService; $this->deletionService = $deletionService; $this->repository = $repository; } /** * Return all of the allocations that exist for a given node. * * @param \Pterodactyl\Http\Requests\Api\Application\Allocations\GetAllocationsRequest $request * @return array */ public function index(GetAllocationsRequest $request): array { $allocations = $this->repository->getPaginatedAllocationsForNode( $request->getModel(Node::class)->id, 50 ); return $this->fractal->collection($allocations) ->transformWith($this->getTransformer(AllocationTransformer::class)) ->toArray(); } /** * Store new allocations for a given node. * * @param \Pterodactyl\Http\Requests\Api\Application\Allocations\StoreAllocationRequest $request * @return array * * @throws \Pterodactyl\Exceptions\DisplayException */ public function store(StoreAllocationRequest $request): array { $this->assignmentService->handle($request->getModel(Node::class), $request->validated()); return response('', 204); } /** * Delete a specific allocation from the Panel. * * @param \Pterodactyl\Http\Requests\Api\Application\Allocations\DeleteAllocationRequest $request * @return \Illuminate\Http\Response * * @throws \Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException */ public function delete(DeleteAllocationRequest $request): Response { $this->deletionService->handle($request->getModel(Allocation::class)); return response('', 204); } }