public function showCategory($slug) { $categories = Category::all(); $category = Category::whereSlug($slug)->first(); $posts = Post::isPublished()->where('category_id', $category->id)->paginate(10); return view('blog::category.show')->withPageTitle($category->name)->withPosts($posts)->withCategory($category)->withCategories($categories)->withActiveCategory($category->id); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $posts = Post::orderBy('created_at', 'desc')->paginate(10); return view('blog::admin.index')->withPosts($posts)->withCategories(Category::all())->withOptionRssName(Option::get('rss_name'))->withOptionRssNumber(Option::get('rss_number')); }