29 lines
562 B
PHP
29 lines
562 B
PHP
<?php
|
|
|
|
namespace App\Events;
|
|
|
|
use Illuminate\Broadcasting\PrivateChannel;
|
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
|
|
|
class UserTyping implements ShouldBroadcast
|
|
{
|
|
public $conversationId;
|
|
public $user;
|
|
|
|
public function __construct($conversationId, $user)
|
|
{
|
|
$this->conversationId = $conversationId;
|
|
$this->user = $user;
|
|
}
|
|
|
|
public function broadcastOn()
|
|
{
|
|
return new PrivateChannel('chat.' . $this->conversationId);
|
|
}
|
|
|
|
public function broadcastAs()
|
|
{
|
|
return 'UserTyping';
|
|
}
|
|
}
|