The Commenter package for Laravel "is a feature-rich modern package that addresses all your commenting needs in a Laravel application." The package includes an admin panel to manage comments across all "commentable" models.
Commenter demo project example
The package models include a Commenter, and a Commentable model. You can use this package with your Eloquent models by implementing the CommentableContract
and CommenterContract
interfaces. The following example illustrates that Post
is commentable, and User
is a commenter:
use LakM\Comments\Concerns\Commentable;
use LakM\Comments\Contracts\CommentableContract;
class Post extends Model implements CommentableContract
{
use Commentable;
}
And the Commentable
interface on the User
model, for example:
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use LakM\Comments\Concerns\Commenter;
class User extends Authenticatable
{
use HasFactory, Notifiable, Commenter;
}
Commenter features:
- Simple, modern, and user-friendly interfaces.
- Mobile responsiveness.
- WYSIWYG editor.
- Syntax highlighting.
- Robust security features.
- Effective spam prevention.
- Reaction options.
- Support for threaded replies.
- User mention functionality.
- Display a list of users who reacted (auth mode only).
- Pagination.
- Support is available for both authentication mode and guest mode (mutually exclusive).
- Advanced filtering and sorting options.
- Responsive design using a combination of Livewire and Alpine.js.
- Optimized performance. And much more.
To get started with this package, I recommend reading the Commenter documentation. You can view the source code on GitHub, and the package author also has a demo project to get a basic overview of this package.
The post Add Comments to your Laravel Application with the Commenter Package appeared first on Laravel News.
Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.