本文整理汇总了PHP中Vote::applySelection方法的典型用法代码示例。如果您正苦于以下问题:PHP Vote::applySelection方法的具体用法?PHP Vote::applySelection怎么用?PHP Vote::applySelection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vote
的用法示例。
在下文中一共展示了Vote::applySelection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getByPostId
public function getByPostId($post_id, Vote $vote)
{
$comments = Cache::remember(Constant::COMMENT_CACHE_NEWLIST_NAME . $post_id, Constant::COMMENT_CACHE_NEWLIST_MINS, function () use($post_id) {
return DB::table('comments')->join('users', 'comments.user_id', '=', 'users.id')->select('comments.id', 'comments.post_id', 'comments.user_id', 'comments.created_at', 'comments.updated_at', 'comments.deleted_at', 'comments.upvotes', 'comments.downvotes', 'comments.parent_id', 'comments.data', 'comments.markdown', 'users.username', 'users.points', 'users.id AS users_user_id', 'users.votes', 'users.anonymous')->where('post_id', '=', $post_id)->orderBy('id', 'asc')->get();
});
F::each($comments, function ($v) {
if ($v->deleted_at != 0) {
$v->username = "deleted";
$v->data = "<p>user deleted this comment</p>";
$v->markdown = "user deleted this comment";
}
return $v;
});
return $vote->applySelection($comments, $vote->COMMENT_TYPE);
}
示例2: getControversialList
public function getControversialList(array $section_ids = [0], $seconds, Vote $vote)
{
return $vote->applySelection($this->getList($section_ids, $seconds, Constant::SORT_ORDERBY_SQL_CONTROVERSIAL, $vote), Constant::POST_TYPE);
}