Secure expense receipts by wiring Media Library to FileDisk

Spatie Media Library now uses the default FileDisk (local_private) for
new uploads instead of the public disk. Expense receipts are no longer
directly web-accessible.

- AppServiceProvider configures media-library disk from FileDisk on boot
- Change media-library fallback from 'public' to 'local'
- Expense receipt URL accessor returns authenticated route instead of
  direct file URL
- Add registerMediaCollections() to Expense model
- Prevent deleting FileDisk that contains files or is a system disk
- Add media:secure command to migrate existing receipts to private disk

Fixes #187
This commit is contained in:
Darko Gjorgjijoski
2026-04-07 01:01:59 +02:00
parent 39c9179888
commit 67268ac2b7
5 changed files with 187 additions and 4 deletions

View File

@@ -31,7 +31,7 @@ return [
* The disk on which to store added files and derived images by default. Choose
* one or more of the disks you've configured in config/filesystems.php.
*/
'disk_name' => env('MEDIA_DISK', 'public'),
'disk_name' => env('MEDIA_DISK', 'local'),
/*
* The maximum file size of an item in bytes.