make sure allocation is unlocked when removed from server

This commit is contained in:
Boy132 2025-11-04 10:17:16 +01:00
parent 5e6b255c59
commit e3f3226276

View File

@ -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')));
}); });