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