Owl\Handlers\Events\EmailNotification::onGetComment PHP Метод

onGetComment() публичный Метод

記事にコメントがついた時のメール通知
public onGetComment ( CommentEvent $event )
$event Owl\Events\Item\CommentEvent
    public function onGetComment(CommentEvent $event)
    {
        $item = $this->itemService->getByOpenItemId($event->getId());
        $recipient = $this->userService->getById($item->user_id);
        $sender = $this->userService->getById($event->getUserId());
        if ($this->userRoleService->isRetire($recipient->id)) {
            return false;
        }
        if ($this->areUsersSame($recipient, $sender)) {
            return false;
        } elseif (!$this->notificationIsEnabled('comment', $recipient->id)) {
            return false;
        }
        $data = $this->getDataForMail($item, $recipient, $sender);
        $data['comment'] = $event->getComment();
        $this->mail->send('emails.action.comment', $data, function ($m) use($recipient, $sender) {
            $m->to($recipient->email)->subject($sender->username . 'さんからコメントがつきました - Owl');
        });
    }