first commit
This commit is contained in:
34
app/Events/ChatEvent.php
Normal file
34
app/Events/ChatEvent.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ChatEvent implements ShouldBroadcast
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $chatId;
|
||||
public $toAdmin;
|
||||
public $userId;
|
||||
|
||||
public function __construct($chatId, $toAdmin = false, $userId = null)
|
||||
{
|
||||
$this->chatId = $chatId;
|
||||
$this->toAdmin = $toAdmin;
|
||||
$this->userId = $userId;
|
||||
}
|
||||
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
return [
|
||||
new Channel('chat-channel'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user