@@ 219-227 (lines=9) @@ | ||
216 | * |
|
217 | * @return bool |
|
218 | */ |
|
219 | public function userUpVoted($topic_id, $user_id) |
|
220 | { |
|
221 | return Vote::query()->where([ |
|
222 | 'user_id' => $user_id, |
|
223 | 'votable_id' => $topic_id, |
|
224 | 'votable_type' => 'Topic', |
|
225 | 'is' => 'upvote', |
|
226 | ])->exists(); |
|
227 | } |
|
228 | ||
229 | /** |
|
230 | * 是否已经反对帖子. |
|
@@ 237-245 (lines=9) @@ | ||
234 | * |
|
235 | * @return bool |
|
236 | */ |
|
237 | public function userDownVoted($topic_id, $user_id) |
|
238 | { |
|
239 | return Vote::query()->where([ |
|
240 | 'user_id' => $user_id, |
|
241 | 'votable_id' => $topic_id, |
|
242 | 'votable_type' => 'Topic', |
|
243 | 'is' => 'downvote', |
|
244 | ])->exists(); |
|
245 | } |
|
246 | ||
247 | /** |
|
248 | * 用户是否已经收藏帖子. |