Comments Manager for Laravel Enso.
This package works exclusively within the Enso ecosystem.
There is a front end implementation for this this api in the accessories package.
For live examples and demos, you may visit laravel-enso.com
click on the photo to view a short demo in compatible browsers
Comes pre-installed in Enso.
The package offers a quick and easy flow for adding comments to any model.
- gives the possibility to add, update and delete comments
- has the option of tagging other users in the comments using
@and the user name
- users are notified via push Notifications when they are tagged
- uses its own policies to ensure users edit comments only when they are allowed to do so
- uses TrackWho to keep track of the users that are posting comments
- depends on Avatar Manager to display user avatars, when available
- uses a light, internal mechanism for tagged user auto-completion
- polymorphic relationships are used, which makes it possible to attach comments to any other entity
- you may publish the configuration and customize the options as needed
- add the
Commentabletrait in the Model to which you need to add comments. You can then use the
- since users post comments, and users can tag other users, the
Usermodel has the
Commentstrait, which gives you access to the user's comments, as well as the comments he's tagged in
- if you need to customize the
CommentTagNotificationyou need to publish it first with
php artisan vendor:publish --tag=comments-notification
- insert the
Commentsvue component where required in your pages/components, see the front end implementation docs for the available options
config/enso/comments.php configuration file you may set the following options:
editableTimeLimit, number, the amount of seconds after which a comment is no longer editable | default is
24 * 60 * 60seconds (1 day)
onDelete, string, option that manages the case when the commentable entity is deleted and it has attached addresses. Valid options are
restrict| default is
With the cascade option, when a commentable model is deleted, the comments attached to it are also deleted. With the restrict option, when attempting to delete a commentable model with attached comments, an exception is thrown.
loggableMorph, the list of entities using the commentable functionality, each mapped to its respective loggable attribute For example:
'commentable' => [ Company::class => 'name', ],
This configuration option is used for activity logging.
Extending the comments
In your project you may have the need to alter and or extend the comment notification. To achieve this, you'd need to:
- create a new CommentTagNotification, ensuring it implements the
- bind your local implementation to the interface in your local
php artisan vendor:publish --tag=comments-config- configuration file
php artisan vendor:publish --tag=enso-config- a common alias for when wanting to update the configuration, once a newer version is released, usually used with the
php artisan vendor:publish --tag=comments-email-template- the templates used for notifications
php artisan vendor:publish --tag=enso-mail- a common alias for when wanting to update the templates used for notifications, usually used with the
php artisan vendor:publish --tag=comments-factory- the factory used for comments
php artisan vendor:publish --tag=enso-factories- a common alias for when wanting to update the factories once a newer version is released, usually used with the
are welcome. Pull requests are great, but issues are good too.
This package is released under the MIT license.