Refactor FileDisk system with per-disk unique names and disk assignments UI

Major changes to the file disk subsystem:

- Each FileDisk now gets a unique Laravel disk name (disk_{id}) instead
  of temp_{driver}, fixing the bug where multiple local disks with
  different roots overwrote each other's config.

- Move disk registration logic from FileDisk model to FileDiskService
  (registerDisk, getDiskName). Model keeps only getDecodedCredentials
  and a deprecated setConfig() wrapper.

- Add Disk Assignments admin UI (File Disk tab) with three purpose
  dropdowns: Media Storage, PDF Storage, Backup Storage. Stored as
  settings (media_disk_id, pdf_disk_id, backup_disk_id).

- Backup tab now uses the assigned backup disk instead of a per-backup
  dropdown. BackupsController refactored to use BackupService which
  centralizes disk resolution. Removed stale 4-second cache.

- Add local_public disk to config/filesystems.php so system disks
  are properly defined.

- Local disk roots stored relative to storage/app/ with hint text
  in the admin modal explaining the convention.

- Fix BaseModal watchEffect -> watch to prevent infinite request
  loops on the File Disk page.

- Fix string/number comparison for disk purpose IDs from settings.

- Add safeguards: prevent deleting disks with files, warn on
  purpose change, prevent deleting system disks.
This commit is contained in:
Darko Gjorgjijoski
2026-04-07 02:04:57 +02:00
parent ea1fc9b799
commit 20085cab5d
20 changed files with 492 additions and 258 deletions

View File

@@ -1461,7 +1461,18 @@
"deleted_message": "File Disk deleted successfully",
"disk_variables_save_successfully": "Disk Configured Successfully",
"disk_variables_save_error": "Disk configuration failed.",
"invalid_disk_credentials": "Invalid credential of selected disk"
"invalid_disk_credentials": "Invalid credential of selected disk",
"disk_assignments": "Disk Assignments",
"disk_assignments_description": "Configure which disk is used for different types of file storage.",
"media_storage": "Media Storage",
"media_storage_description": "Used for expense receipts, avatars, and company logos.",
"pdf_storage": "PDF Storage",
"pdf_storage_description": "Used for generated invoice, estimate, and payment PDFs.",
"backup_storage": "Backup Storage",
"backup_storage_description": "Used for application backups.",
"purposes_saved": "Disk assignments saved successfully",
"local_root_hint": "Path is relative to storage/app/. For example, entering \"backups\" will store files in storage/app/backups/.",
"change_disk_warning": "Changing disk assignments will only affect new uploads. Existing files will remain on their original disk and will continue to be accessible. If you need to move existing files, use the command: php artisan media:secure"
},
"taxations": {
"add_billing_address": "Enter Billing Address",