mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-02 04:15:52 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
27 lines
621 B
PHP
27 lines
621 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pterodactyl\Actions\Nodes;
|
|
|
|
use Pterodactyl\Contracts\Nodes\DeletesNodes;
|
|
use Pterodactyl\Exceptions\Service\HasActiveServersException;
|
|
use Pterodactyl\Models\Node;
|
|
|
|
final class DeleteNode implements DeletesNodes
|
|
{
|
|
/**
|
|
* Delete a node from the panel if no servers are attached to it.
|
|
*
|
|
* @throws HasActiveServersException
|
|
*/
|
|
public function delete(Node $node): void
|
|
{
|
|
if ($node->servers()->exists()) {
|
|
throw new HasActiveServersException(trans('exceptions.node.servers_attached'));
|
|
}
|
|
|
|
$node->delete();
|
|
}
|
|
}
|