/** * Show one blog post * GET * * @param int $id * @param string $title * @return Response */ public function showBlog($id, $title) { $blog = BlogManager::find($id); $nextBlog = BlogManager::find($blog->id + 1); $prevBlog = BlogManager::find($blog->id - 1); $comments = BlogCommentManager::join('accounts', 'accounts.guid', '=', 'cms_blogs_comments.author')->where('blog_id', $blog->id)->orderBy('date', 'desc')->paginate(10); $countComments = BlogCommentManager::where('blog_id', $blog->id)->count(); return view('home.blog', compact('blog', 'comments', 'nextBlog', 'prevBlog', 'countComments')); }
public function getCmt($cmt_for, $type) { return Comment::join('users', 'users.id', '=', 'comments.cmt_of')->where('cmt_for', $cmt_for)->where('typeCMT', $type)->select('comments.id as id', 'comments.cmt_of as cmt_of', 'users.name as name', 'comments.time as time', 'comments.content as content')->orderBy('id', 'desc')->get(); }