/** * Show the category articles * * @param Category $category * @return Response */ public function index(Category $category) { $articles = $category->articles()->published()->orderBy('published_at', 'desc')->paginate(5); return view('application.category.index', compact('articles', 'category')); }
public static function getPostAvaiable(Category $category) { return $category->articles()->where('status', 1)->paginate(5); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show(Category $category) { $articles = $category->articles()->latest('published_at')->published()->get(); return view('admin.articles.index', compact('articles')); }
/** * Hiển thị thông tin bài viết theo category * * @param Category $category * @return Response */ public function listArticles(Category $category) { $articles = $category->articles()->active()->orderBy('published_at', 'desc')->paginate(config('blog.record_per_page')); return view('categories.list_articles', compact('category', 'articles')); }