refactor(backups): centralize storage deletion guard

This commit is contained in:
Andras Bacsai
2026-07-19 23:20:46 +02:00
parent 4e03be755d
commit bf72fd5d88
6 changed files with 38 additions and 21 deletions
+7
View File
@@ -56,6 +56,13 @@ class LocalPersistentVolume extends BaseModel
return $this->morphMany(ScheduledVolumeBackup::class, 'backupable');
}
public function abortIfScheduledBackupsExist(): void
{
if ($this->scheduledBackups()->exists()) {
abort(422, 'Delete this volume backup schedule and its archives before deleting the volume.');
}
}
protected function customizeName($value)
{
return str($value)->trim()->value;