public function onCommentSubmitted(CommentEvent $event) { $comment = $event->getComment(); foreach ($this->bannedWords as $bannedWord) { if (in_array($bannedWord, explode(" ", $comment->message))) { $comment->approved = false; $event->stopPropagation(); return; } } }
public function onCommentSubmitted(CommentEvent $event) { $comment = $event->getComment(); $request = $event->getRequest(); $comment->ip = $request->getClientIp(); }
public function onCommentSubmitted(CommentEvent $event) { $comment = $event->getComment(); // Send to the comment's author a notification $comment->notified = true; }