NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages

Each lifecycle step dispatches an event under RoundlyConsulting\Comments\Events, carrying the comment on its $comment property (CommentMentioned carries $mention):

EventPayloadWhen
CommentCreated$commentA comment row is created — any write, including factories.
CommentUpdated$commentA body is edited through Comments::update().
CommentDeleted$commentA comment is soft-deleted (single or deleteAll()).
CommentApproved$commentA comment is approved (single or approveAll()).
CommentHidden$commentA comment is hidden — by a moderator, hideAll() or the auto-hide listener.
CommentThreadLocked$commentlockThread() or lockReplies() actually locks the thread under the comment.
CommentThreadUnlocked$commentunlockThread() or unlockReplies() actually lifts the lock.
CommentMentioned$mentionAn approved comment mentions a resolved person it has not notified yet — on write, edit or approval; once per person.
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Notification;
use RoundlyConsulting\Comments\Events\CommentCreated;

Event::listen(function (CommentCreated $event): void {
    // $event->comment is the freshly created Comment
    Notification::send(
        $event->comment->commentable,
        new NewCommentNotification($event->comment),
    );
});

The events use SerializesModels, so queued listeners work out of the box. Restoring a comment dispatches no event. Like and report events come from Likes for Laravel and Reports for Laravel.

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.