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')); }
/** * 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'); }
public function prijavljeni() { if (!Auth::check()) { return redirect('/'); } $komentari = Comment::orderBy('flag', 'desc')->where('flag', '>', '0')->get(); return view('auth.prijavljeni', compact('komentari')); }
public function forAll() { return Comment::orderBy('created_at', 'desc')->get(); }
/** * Display a listing of the resource. * * @return Response */ public function index() { // return Comment::orderBy('created_at', 'DESC')->limit(5)->get(); }
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()); }
/** * 获取账户列表. * * @param int $pageSize 分页大小 * * @return \Illuminate\Pagination\Paginator */ public function lists($pageSize) { return $this->model->orderBy('comment_id', 'desc')->paginate($pageSize); }
public function scopeAllComments() { $comments = Comment::orderBy('created_at', 'desc')->paginate(9); return $comments; }