Replace allocation repository
This commit is contained in:
parent
860b2d890b
commit
cd49324d46
10 changed files with 95 additions and 164 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue