Files
pterodactyl-panel/app/Actions/Locations/DeleteLocation.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
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();
}
}