mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-01 11:55:51 -05:00
22 lines
570 B
PHP
22 lines
570 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
|
|
{
|
|
public function delete(Allocation $allocation): void
|
|
{
|
|
if ($allocation->server_id !== null) {
|
|
throw new ServerUsingAllocationException(trans('exceptions.allocations.server_using'));
|
|
}
|
|
|
|
$allocation->delete();
|
|
}
|
|
}
|