mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-02 12:25:44 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
27 lines
654 B
PHP
27 lines
654 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pterodactyl\Actions\Locations;
|
|
|
|
use Pterodactyl\Contracts\Locations\DeletesLocations;
|
|
use Pterodactyl\Exceptions\Service\Location\HasActiveNodesException;
|
|
use Pterodactyl\Models\Location;
|
|
|
|
final class DeleteLocation implements DeletesLocations
|
|
{
|
|
/**
|
|
* Delete a location, provided no nodes are assigned to it.
|
|
*
|
|
* @throws HasActiveNodesException
|
|
*/
|
|
public function delete(Location $location): void
|
|
{
|
|
if ($location->nodes()->exists()) {
|
|
throw new HasActiveNodesException(trans('exceptions.locations.has_nodes'));
|
|
}
|
|
|
|
$location->delete();
|
|
}
|
|
}
|