*/ public array $services = []; public ?string $checkedAt = null; public function mount(): void { $this->refreshHealth(); } public function refreshHealth(): void { $this->services = app(SystemHealth::class)->services(); $this->checkedAt = now()->format('H:i:s'); } public function worstState(): string { $states = array_column($this->services, 'state'); return in_array('offline', $states, true) ? 'offline' : (in_array('warning', $states, true) ? 'warning' : 'online'); } public function problemCount(): int { return count(array_filter($this->services, fn ($s) => $s['state'] !== 'online')); } public function render() { return view('livewire.host'); } }