This commit is contained in:
Mekan1206
2026-05-01 16:53:04 +05:00
parent f772562376
commit 005b428cf1
12 changed files with 261 additions and 2 deletions

View File

@@ -0,0 +1,37 @@
<?php
namespace App\Events\Conversation;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class MessageSent implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $message;
/**
* Create a new event instance.
*/
public function __construct($message)
{
$this->message = $message->load('user');
}
/**
* Get the channels the event should broadcast on.
*
* @return array<int, Channel>
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('chat.'.$this->message->conversation_id),
];
}
}