52 lines
1.4 KiB
Markdown
52 lines
1.4 KiB
Markdown
---
|
|
title: Reactions
|
|
description: Emoji reactions on comments.
|
|
navigation:
|
|
icon: i-lucide-smile
|
|
seo:
|
|
description: Configure emoji reactions for comments.
|
|
---
|
|
|
|
## Default Reactions
|
|
|
|
Six emoji reactions are available out of the box:
|
|
|
|
| Key | Emoji | Label |
|
|
|-----|-------|-------|
|
|
| `thumbs_up` | :thumbsup: | Like |
|
|
| `heart` | :heart: | Love |
|
|
| `celebrate` | :tada: | Celebrate |
|
|
| `laugh` | :smile: | Laugh |
|
|
| `thinking` | :thinking: | Thinking |
|
|
| `sad` | :cry: | Sad |
|
|
|
|
## How Reactions Work
|
|
|
|
- Each user can add one reaction of each type per comment
|
|
- Clicking the same reaction again removes it (toggle behavior)
|
|
- The reaction summary shows which users reacted with each emoji
|
|
- A `CommentReacted` event is dispatched with `action: 'added'` or `'removed'`
|
|
|
|
## Customizing Reactions
|
|
|
|
Override the emoji set in your config:
|
|
|
|
```php
|
|
// config/comments.php
|
|
'reactions' => [
|
|
'emoji_set' => [
|
|
'thumbs_up' => "\u{1F44D}",
|
|
'thumbs_down' => "\u{1F44E}",
|
|
'heart' => "\u{2764}\u{FE0F}",
|
|
'fire' => "\u{1F525}",
|
|
'eyes' => "\u{1F440}",
|
|
],
|
|
],
|
|
```
|
|
|
|
Keys are stored in the database. If you change a key, existing reactions with the old key will no longer display.
|
|
|
|
## Storage
|
|
|
|
Reactions are stored in the `comment_reactions` table with a unique constraint on `(comment_id, user_id, user_type, reaction)`, ensuring one reaction of each type per user per comment.
|