Snapshot of main at 9f39a6e1e (2026-11-02)

This commit is contained in:
Ronald Huynen committed 2026-11-02 10:41:47 +01:00
commit 6ccf1792d7
2580 files changed
+1040202

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
<?php
// app/Http/Livewire/OnlineUsersList.php
namespace App\Http\Livewire;
use App\Services\PresenceService;
use Livewire\Attributes\On;
use Livewire\Component;
class OnlineUsersList extends Component
{
public $onlineUsers = [];
public $guard = 'web';
public $showCount = true;
public $showAvatars = true;
public $maxDisplay = 10;
public $refreshInterval = 60; // Fallback poll — primary updates come via Reverb echo-presence event
public function mount($guard = 'web', $showCount = true, $showAvatars = true, $maxDisplay = 10)
{
$this->guard = $guard;
$this->showCount = $showCount;
$this->showAvatars = $showAvatars;
$this->maxDisplay = $maxDisplay;
$this->loadOnlineUsers();
}
#[On('echo-presence:presence-{guard}-users,.UserPresenceUpdated')]
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');
}
}