Files
pterodactyl-panel/app/Actions/Allocations/DeleteAllocation.php
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

27 lines
706 B
PHP

<?php
declare(strict_types=1);
namespace Pterodactyl\Actions\Allocations;
use Pterodactyl\Contracts\Allocations\DeletesAllocations;
use Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException;
use Pterodactyl\Models\Allocation;
final class DeleteAllocation implements DeletesAllocations
{
/**
* Delete an allocation, provided no server is attached to it.
*
* @throws ServerUsingAllocationException
*/
public function delete(Allocation $allocation): void
{
if ($allocation->server_id !== null) {
throw new ServerUsingAllocationException(trans('exceptions.allocations.server_using'));
}
$allocation->delete();
}
}