forked from eatvio/eatvio-infra
30 lines
610 B
PHP
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');
|
|
}
|
|
}
|