belongsTo(Client::class); } public function getUrlAttribute(): string { return route('files.serve', $this->id); } public function getHumanSizeAttribute(): string { $bytes = $this->size; if ($bytes >= 1073741824) return round($bytes / 1073741824, 2) . ' GB'; if ($bytes >= 1048576) return round($bytes / 1048576, 2) . ' MB'; if ($bytes >= 1024) return round($bytes / 1024, 2) . ' KB'; return $bytes . ' B'; } public function getIsImageAttribute(): bool { return str_starts_with($this->mime_type, 'image/'); } public function getIconAttribute(): string { if ($this->is_image) return '🖼️'; if (str_starts_with($this->mime_type, 'video/')) return '🎬'; if (str_contains($this->mime_type, 'pdf')) return '📄'; return '📁'; } }