forked from eatvio/eatvio-infra
26 lines
574 B
PHP
26 lines
574 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Chat;
|
|
|
|
use Livewire\Component;
|
|
|
|
class Tracker extends Component
|
|
{
|
|
public $showNewMessageNotifycation = false;
|
|
public $myMessages = [];
|
|
|
|
// Special Syntax: ['echo:{channel},{event}' => '{method}']
|
|
protected $listeners = ['echo:direct-chat,ChatMessageUpdated' => 'notifyNewMessage'];
|
|
|
|
public function notifyNewMessage($payload): void
|
|
{
|
|
$this->myMessages[] = $payload;
|
|
$this->showNewMessageNotifycation = true;
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.chat.tracker');
|
|
}
|
|
}
|