Installation

Install the package and publish the migrations.

You can install the package via composer:

composer require businesstilto/commentable

You can publish and run the migrations with:

php artisan vendor:publish --tag="commentable-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="commentable-config"

You can publish the translation files with:

php artisan vendor:publish --tag="commentable-translations"

Optionally, you can publish the views using:

php artisan vendor:publish --tag="commentable-views"

This is the contents of the published config file:

<?php

return [
    /*
    |--------------------------------------------------------------------------
    | Comment model
    |--------------------------------------------------------------------------
    */
    'comment' => [
        'model' => Tilto\Commentable\Models\Comment::class,
        'policy' => Tilto\Commentable\Policies\CommentPolicy::class,
    ],

    /*
    |--------------------------------------------------------------------------
    | Reply
    |--------------------------------------------------------------------------
    */
    'reply' => [
        'allow_self_reply' => false,
    ],

    /*
    |--------------------------------------------------------------------------
    | Editor
    |--------------------------------------------------------------------------
    |
    | 'submit_shortcut' controls the keyboard shortcut for submitting a comment:
    | - 'mod+enter': Ctrl + Enter (Windows/Linux) or Cmd + Enter (macOS)
    | - 'enter': Enter submits, Shift + Enter inserts a new line
    | - false: no keyboard shortcut
    |
    */
    'editor' => [
        'submit_shortcut' => 'mod+enter',
    ],

    /*
    |--------------------------------------------------------------------------
    | Reaction
    |--------------------------------------------------------------------------
    */
    'reaction' => [
        'model' => Tilto\Commentable\Models\CommentReaction::class,
        'allowed' => ['👍', '❤️', '😂', '😮', '😢', '🤔'],
        'show_reactors_tooltip' => true,
    ],
];

Version 0.3.0 introduces breaking changes related to reactions. Please refer to the upgrade guide for detailed instructions on upgrading safely.

Usage