Exemplo n.º 1
0
 /**
  * @param  Comment $comment
  * @return void
  */
 public function onCommentCreated(Comment $comment)
 {
     if (!$comment->parent) {
         return false;
     }
     $to = $comment->parent->present()->authorEmail;
     if ($to === $comment->present()->authorEmail) {
         return false;
     }
     if ($comment->parent->user) {
         $comment->parent->user->notifications()->save(new Notification(['type' => Notification::TYPE_COMMENT, 'data' => $comment->id]));
         if (!$comment->parent->user->hasNotification('comment')) {
             return false;
         }
     }
     $this->mailer->sendCommentReply($to, $comment);
 }
Exemplo n.º 2
0
 /**
  * Send comment reply.
  * 
  * @param  mixed  				   $to
  * @param  \FIIP\Comments\Comment  $data
  * @return void
  */
 public function sendCommentReply($to, Comment $comment)
 {
     $data = ['author' => $comment->present()->authorName, 'content' => $comment->content, 'url' => $comment->present()->url];
     $subject = 'Ai primit un răspuns de la ' . $data['author'];
     $this->sendTo($to, $subject, 'emails.comment-reply', $data);
 }