Пример #1
0
 /**
  * 是否已经反对帖子.
  *
  * @param $topic_id
  * @param $user_id
  *
  * @return bool
  */
 public function userDownVoted($topic_id, $user_id)
 {
     return Vote::query()->where(['user_id' => $user_id, 'votable_id' => $topic_id, 'votable_type' => 'Topic', 'is' => 'downvote'])->exists();
 }
Пример #2
0
 /**
  * 是否已经反对帖子.
  *
  * @param $topic_id
  * @param $user_id
  *
  * @return bool
  */
 protected function isDownVoted($topic_id, $user_id)
 {
     return Vote::where(['user_id' => $user_id, 'votable_id' => $topic_id, 'votable_type' => 'Topic', 'is' => 'downvote'])->exists();
 }