@@ -31,6 +31,7 @@ Create a Chat application for your multiple Models
3131 - [ Mark whole conversation as read] ( #mark-whole-conversation-as-read )
3232 - [ Unread messages count] ( #unread-messages-count )
3333 - [ Delete a message] ( #delete-a-message )
34+ - [ Message Reactions] ( #message-reactions )
3435 - [ Cleanup Deleted Messages] ( #cleanup-deleted-messages )
3536 - [ Clear a conversation] ( #clear-a-conversation )
3637 - [ Get participant conversations] ( #Get-participant-conversations )
@@ -256,6 +257,66 @@ Chat::conversation($conversation)->setParticipant($participantModel)->unreadCoun
256257Chat::message($message)->setParticipant($participantModel)->delete();
257258```
258259
260+ #### Message Reactions
261+
262+ Add emoji or text-based reactions to messages:
263+
264+ ``` php
265+ // Add a reaction
266+ Chat::message($message)->setParticipant($participantModel)->react('👍');
267+
268+ // Add multiple different reactions
269+ Chat::message($message)->setParticipant($participantModel)->react('❤️');
270+ ```
271+
272+ Remove a reaction:
273+
274+ ``` php
275+ Chat::message($message)->setParticipant($participantModel)->unreact('👍');
276+ ```
277+
278+ Toggle a reaction (add if not present, remove if present):
279+
280+ ``` php
281+ $result = Chat::message($message)->setParticipant($participantModel)->toggleReaction('👍');
282+ // $result = ['added' => true/false, 'reaction' => Reaction|null]
283+ ```
284+
285+ Get reactions summary with counts:
286+
287+ ``` php
288+ $summary = Chat::message($message)->reactionsSummary();
289+ // ['👍' => 5, '❤️' => 3, '😂' => 1]
290+ ```
291+
292+ Check if participant has reacted:
293+
294+ ``` php
295+ // Check for specific reaction
296+ Chat::message($message)->setParticipant($participantModel)->hasReacted('👍');
297+
298+ // Check for any reaction
299+ Chat::message($message)->setParticipant($participantModel)->hasReacted();
300+ ```
301+
302+ Get all reactions on a message:
303+
304+ ``` php
305+ $reactions = Chat::message($message)->reactions();
306+ ```
307+
308+ You can also access reactions directly on the Message model:
309+
310+ ``` php
311+ $message->reactions; // All reactions
312+ $message->getReactionsSummary(); // Grouped counts
313+ $message->react($participant, '👍'); // Add
314+ $message->unreact($participant, '👍'); // Remove
315+ $message->hasReacted($participant, '👍'); // Check
316+ ```
317+
318+ ** Broadcasting** : When broadcasting is enabled, ` MessageReactionAdded ` and ` MessageReactionRemoved ` events are broadcast to the conversation channel.
319+
259320#### Cleanup Deleted Messages
260321
261322What to cleanup when all participants have deleted a ` $message ` or ` $conversation ` ?
0 commit comments