ByteHumanReadable::class, 'options' => 'array', ]; protected static function newFactory(): Factory { return FileFactory::new(); } protected static function booted(): void { // Whenever this model is deleted from the DB, delete the physical file static::deleted(function (File $file) { if ($file->path) { // Ensure the disk matches where you saved it (e.g., 'public' or 's3') Storage::disk($file->disk)->delete($file->path); } }); } /** * @throws Exception */ public function getUrlAttribute(): string { return asset_static($this->path); } public function fileable(): MorphTo { return $this->morphTo(); } }