laravel-enso/commentsmanager

This package is abandoned and no longer maintained. The author suggests using the laravel-enso/comments package instead.

Comments Manager for Laravel Enso

Maintainers

Package info

github.com/laravel-enso/comments

pkg:composer/laravel-enso/commentsmanager

Statistics

Installs: 16 876

Dependents: 2

Suggesters: 0

Stars: 11

Open Issues: 0

4.6.4 2026-04-20 17:08 UTC

This package is auto-updated.

Last update: 2026-04-21 15:24:26 UTC


README

License Stable Downloads PHP Issues Merge Requests

Description

Comments adds polymorphic comments and tagged-user notifications to Enso models.

The package exposes a reusable Commentable trait, ships the comments CRUD API used by the backoffice, tracks authorship through Enso audit traits, and supports tagged users through a pivot relation and queued notifications.

Delete behavior is configurable, allowing applications to either cascade comment deletion or block deletion when related comments exist.

Installation

Install the package:

composer require laravel-enso/comments

Run the package migrations:

php artisan migrate

Optional publishes:

php artisan vendor:publish --tag=comments-config
php artisan vendor:publish --tag=comments-mail
php artisan vendor:publish --tag=comments-factory

Default configuration:

return [
    'editableTimeLimit' => 24 * 60 * 60,
    'onDelete' => 'cascade',
    'humanReadableDates' => true,
    'loggableMorph' => [
        'commentable' => [],
    ],
];

Features

  • Polymorphic one-to-one and one-to-many comments through the Commentable trait.
  • Tagged users stored on a pivot table and notified through queued notifications.
  • Comments API with list, create, update, destroy, and user option endpoints.
  • Configurable delete strategy via restrict or cascade.
  • Automatic parent touching for updated commentable records.

Usage

Add the trait to any model that should expose comments:

use Illuminate\Database\Eloquent\Model;
use LaravelEnso\Comments\Traits\Commentable;

class Post extends Model
{
    use Commentable;
}

Available relationships:

  • comment()
  • comments()

When a model is deleted, the package will either reject the deletion or cascade comment deletion based on enso.comments.onDelete.

Tagged users can be synchronized and notified through the Comment model:

$comment->syncTags($taggedUsers)->notify('/posts/1');

API

HTTP routes

  • GET api/core/comments
  • POST api/core/comments
  • PATCH api/core/comments/{comment}
  • DELETE api/core/comments/{comment}
  • GET api/core/comments/users

Route names:

  • core.comments.index
  • core.comments.store
  • core.comments.update
  • core.comments.destroy
  • core.comments.users

Model surface

LaravelEnso\\Comments\\Models\\Comment

Useful methods:

  • scopeFor(array $params): Builder
  • syncTags(array $taggedUsers)
  • notify(string $path)

Depends On

Required Enso packages:

Companion frontend package:

Contributions

are welcome. Pull requests are great, but issues are good too.

Thank you to all the people who already contributed to Enso!