本文整理汇总了PHP中app\Comment::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Comment::orderBy方法的具体用法?PHP Comment::orderBy怎么用?PHP Comment::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Comment
的用法示例。
在下文中一共展示了Comment::orderBy方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public function show($id)
{
$article = Article::find($id);
$user = User::find($article->user_id);
$comment = new Comment();
$comments = $comment->orderBy('updated_at', 'desc')->with('user')->get();
return view('articles.show', compact('article', 'user', 'comments'));
}
示例2: getIndex
/**
* Display a listing of the resource.
*
* @return Response
*/
public function getIndex(Request $request)
{
$mod = Comment::orderBy('updated_at', 'desc');
$this->commentSearch($mod, $request);
$comments = $mod->paginate(10);
$this->assign('comments', $comments);
return $this->display('admin.comment.index');
}
示例3: prijavljeni
public function prijavljeni()
{
if (!Auth::check()) {
return redirect('/');
}
$komentari = Comment::orderBy('flag', 'desc')->where('flag', '>', '0')->get();
return view('auth.prijavljeni', compact('komentari'));
}
示例4: forAll
public function forAll()
{
return Comment::orderBy('created_at', 'desc')->get();
}
示例5: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
//
return Comment::orderBy('created_at', 'DESC')->limit(5)->get();
}
示例6: post
public function post($id)
{
$post = Post::find($id);
return view('pages.post')->with('post', $post)->with('user_id', \Session::get('user_id'))->with('comments', Comment::orderBy('created_at', 'desc')->where(['post_id' => $id])->get());
}
示例7: lists
/**
* 获取账户列表.
*
* @param int $pageSize 分页大小
*
* @return \Illuminate\Pagination\Paginator
*/
public function lists($pageSize)
{
return $this->model->orderBy('comment_id', 'desc')->paginate($pageSize);
}
示例8: scopeAllComments
public function scopeAllComments()
{
$comments = Comment::orderBy('created_at', 'desc')->paginate(9);
return $comments;
}