guard = $guard; $this->showCount = $showCount; $this->showAvatars = $showAvatars; $this->maxDisplay = $maxDisplay; $this->loadOnlineUsers(); } public function loadOnlineUsers() { try { $presenceService = app(PresenceService::class); $users = $presenceService->getOnlineUsers($this->guard); // Limit the display count $this->onlineUsers = $users->take($this->maxDisplay)->toArray(); } catch (\Exception $e) { $this->onlineUsers = []; } } public function render() { return view('livewire.online-users-list'); } }