Events
Events are dispatched when a comment is created, reacted to, or when users are mentioned or subscribed:
Kirschbaum\Commentions\Events\UserWasMentionedEventKirschbaum\Commentions\Events\UserIsSubscribedToCommentableEventKirschbaum\Commentions\Events\CommentWasCreatedEventKirschbaum\Commentions\Events\CommentWasReactedEvent
Subscription Events
When a new comment is created, all subscribed users receive notifications through the UserIsSubscribedToCommentableEvent. You can listen to this event to send custom notifications:
namespace App\Listeners;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Notifications\NewCommentNotification;
use Kirschbaum\Commentions\Events\UserIsSubscribedToCommentableEvent;
class SendSubscribedUserNotification implements ShouldQueue
{
use InteractsWithQueue;
public function handle(UserIsSubscribedToCommentableEvent $event): void
{
$event->user->notify(
new NewCommentNotification($event->comment)
);
}
}