disk = $diskSpace->snapshot(); } public function shouldRender(): bool { return $this->disk !== null; } /** * Progress fill color based on remaining free space. */ public function barColor(): string { $freePercent = $this->disk['free_percent'] ?? 100; if ($freePercent <= 5) { return 'bg-red-600'; } if ($freePercent <= 15) { return 'bg-amber-500'; } return 'bg-teal-600'; } /** * Get the view / contents that represent the component. */ public function render(): View|Closure|string { return view('components.disk-space-bar'); } }