Prevent deleting nodes if there are active servers
This commit is contained in:
parent
18e5c17ebe
commit
06c773c3b1
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Exceptions\Service\HasActiveServersException;
|
||||
use App\Repositories\Daemon\DaemonConfigurationRepository;
|
||||
use Exception;
|
||||
use Illuminate\Support\Str;
|
||||
@ -135,6 +136,10 @@ class Node extends Model
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
static::deleting(function (self $node) {
|
||||
throw_if($node->servers()->count(), new HasActiveServersException(trans('exceptions.egg.delete_has_servers')));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user