applications; $databases = $service->databases; foreach ($applications as $application) { if ($application->status === 'running') { $foundRunning = true; } else { $isDegraded = true; } } foreach ($databases as $database) { if ($database->status === 'running') { $foundRunning = true; } else { $isDegraded = true; } } if ($foundRunning && !$isDegraded) { $this->complexStatus = 'running'; } else if ($foundRunning && $isDegraded) { $this->complexStatus = 'degraded'; } else if (!$foundRunning && $isDegraded) { $this->complexStatus = 'exited'; } } /** * Get the view / contents that represent the component. */ public function render(): View|Closure|string { return view('components.status.services'); } }