Replace allocation repository

This commit is contained in:
Lance Pioch 2022-10-23 02:02:58 -04:00
parent 860b2d890b
commit cd49324d46
10 changed files with 95 additions and 164 deletions

View file

@ -3,18 +3,10 @@
namespace Pterodactyl\Services\Allocations;
use Pterodactyl\Models\Allocation;
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
use Pterodactyl\Exceptions\Service\Allocation\ServerUsingAllocationException;
class AllocationDeletionService
{
/**
* AllocationDeletionService constructor.
*/
public function __construct(private AllocationRepositoryInterface $repository)
{
}
/**
* Delete an allocation from the database only if it does not have a server
* that is actively attached to it.
@ -27,6 +19,6 @@ class AllocationDeletionService
throw new ServerUsingAllocationException(trans('exceptions.allocations.server_using'));
}
return $this->repository->delete($allocation->id);
return $allocation->delete();
}
}