diff --git a/app/Models/Allocation.php b/app/Models/Allocation.php index b43dc3daf..fc529829c 100644 --- a/app/Models/Allocation.php +++ b/app/Models/Allocation.php @@ -78,6 +78,12 @@ class Allocation extends Model 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) { throw_if($allocation->server_id, new ServerUsingAllocationException(trans('exceptions.allocations.server_using'))); });