本文整理匯總了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);
}