Files
eatvio-infra/app/Livewire/Chat/Tracker.php
2024-01-15 01:05:10 +03:00

30 lines
610 B
PHP

<?php
namespace App\Livewire\Chat;
use Livewire\Component;
use Illuminate\View\View;
class Tracker extends Component
{
public int|bool $showNewMessageNotifycation = false;
public array $myMessages = [];
protected function getListeners(): array
{
return ['echo:direct-chat,ChatMessageUpdated' => 'notifyNewMessage'];
}
public function notifyNewMessage(string $payload): void
{
$this->myMessages[] = $payload;
$this->showNewMessageNotifycation = true;
}
public function render(): View
{
return view('livewire.chat.tracker');
}
}