/**
  * @param User $user
  *
  * @return int
  * @throws Exception
  */
 public function unlike(User $user)
 {
     if (!$this->userLikes($user)) {
         throw new Exception("User does not like that comment");
     }
     $comment = $this->objectOrId instanceof Comment ? $this->objectOrId : Comment::find($this->objectOrId);
     $likes = Like::where('userId', $user->id)->where('commentId', $comment->id)->get();
     $deleted = 0;
     foreach ($likes as $like) {
         if ($like->delete()) {
             ++$deleted;
         }
     }
     if ($deleted) {
         $comment->likeCount -= $deleted;
         $comment->save();
     }
     return $deleted;
 }
 public function getText()
 {
     $usernames = $this->getUsernameText();
     $postTitle = null;
     if ($this->postId) {
         $post = Post::find($this->postId);
         $postTitle = $post ? $post->title : '';
     } elseif ($this->commentId) {
         if ($comment = Comment::find($this->commentId)) {
             $post = Post::find($comment->postId);
             $postTitle = $post ? $post->title : '';
         }
     }
     $stickerName = null;
     if ($this->stickerId) {
         $stickerRepository = new StickerRepository();
         $sticker = $stickerRepository->find($this->stickerId);
         $stickerName = $sticker ? $sticker->name : '';
     }
     $taskName = null;
     if ($this->taskId) {
         $taskRepository = new TaskRepository();
         $task = $taskRepository->find($this->taskId);
         $taskName = $task ? $task->name : '';
     }
     return Lang::get('notifications.types.' . $this->type, ['usernames' => $usernames, 'stickerName' => $stickerName, 'taskName' => $taskName, 'postTitle' => $postTitle]);
 }