se cargan modulos de chat en tiempo real

This commit is contained in:
2026-02-28 16:10:19 -06:00
parent 68d32dbd88
commit aeb24f2874
28 changed files with 1830 additions and 33 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Events;
use App\Models\Message;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
class ChatMessageSent implements ShouldBroadcastNow
{
public $message;
public function __construct(Message $message)
{
$this->message = $message->load('user');
}
public function broadcastOn()
{
return new PrivateChannel(
'chat.' . $this->message->conversation_id
);
}
public function broadcastAs()
{
return 'ChatMessageSent';
}
}