mirror of
https://github.com/pelican-dev/panel.git
synced 2025-11-09 18:19:27 +01:00
make sure allocation is unlocked when removed from server
This commit is contained in:
parent
5e6b255c59
commit
e3f3226276
@ -78,6 +78,12 @@ class Allocation extends Model
|
|||||||
|
|
||||||
protected static function booted(): void
|
protected static function booted(): void
|
||||||
{
|
{
|
||||||
|
static::updating(function (self $allocation) {
|
||||||
|
if (is_null($allocation->server_id)) {
|
||||||
|
$allocation->is_locked = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
static::deleting(function (self $allocation) {
|
static::deleting(function (self $allocation) {
|
||||||
throw_if($allocation->server_id, new ServerUsingAllocationException(trans('exceptions.allocations.server_using')));
|
throw_if($allocation->server_id, new ServerUsingAllocationException(trans('exceptions.allocations.server_using')));
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user