From af00bcb8b1913421de55fad26b56ef3ba66482b2 Mon Sep 17 00:00:00 2001 From: Dylan Aird Date: Wed, 23 Mar 2022 23:22:01 +1100 Subject: [PATCH 1/2] Customize messageWasSent --- src/Models/Message.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Models/Message.php b/src/Models/Message.php index 4498b7a..70d8c3c 100644 --- a/src/Models/Message.php +++ b/src/Models/Message.php @@ -96,7 +96,8 @@ public function send(Conversation $conversation, string $body, Participation $pa ]); if (Chat::broadcasts()) { - broadcast(new MessageWasSent($message))->toOthers(); + $class = Chat::sentMessageEvent() ? Chat::sentMessageEvent() : MessageWasSent::class; + broadcast(new $class($message))->toOthers(); } $this->createNotifications($message); From 9aae6c090a6ecf5fd954cea0a59a09a7a6fe7767 Mon Sep 17 00:00:00 2001 From: Dylan Aird Date: Wed, 23 Mar 2022 23:43:20 +1100 Subject: [PATCH 2/2] Add in comments to config file. --- config/musonza_chat.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/musonza_chat.php b/config/musonza_chat.php index c1e660e..574657f 100755 --- a/config/musonza_chat.php +++ b/config/musonza_chat.php @@ -9,6 +9,15 @@ */ 'broadcasts' => false, + /* + * This will allow you to specify your own broadcast class incase you need to modify the payload for the event + * Example: + * Event: App\Events\ChatMessageWasSent + * + * */ + + 'sent_message_event' => null, + /* * Specify the fields that you want to return each time for the sender. * If not set or empty, all the columns for the sender will be returned