json(); $presence = $data["data"]; Cache::put('discord_presence', $presence, now()->addSeconds(60)); return $presence; } public function getOnlineStatus(): array { $presence = $this->getDiscordPresence(); return match ($presence["discord_status"]) { "online", "dnd" => [ "text" => "online", "color" => "#02c83a" ], "idle" => [ "text" => "away", "color" => "#d77c20" ], default => [ "text" => "offline", "color" => "#ca3329" ], }; } /** * Get the view / contents that represent the component. */ public function render(): View|Closure|string { return view('components.discord-status', [ 'status' => $this->getOnlineStatus(), ]); } }