public function index() { $data = ['title' => 'Categories', 'categories' => Categories::i()->allWithPostsCount()]; $this->title->prepend($data['title']); View::share('menu_item_active', 'categories'); return view('root.categories.index', $data); }
public function compose(View $view) { $categories = \App\Models\Categories::i()->withPostsCount(); $posts_count = \App\Models\Posts::active()->count(); $view->with('categories', $categories); $view->with('posts_count', $posts_count); }
public function index() { Title::prepend('Categories'); $data = ['title' => Title::renderr(' : ', true), 'categories' => Categories::i()->allWithPostsCount()]; view()->share('menu_item_active', 'categories'); return view('root.categories.index', $data); }
public function index($slug = '') { if ($slug != '') { $category = Categories::i()->getBySlug($slug); if (empty($category)) { abort(404); } $category_id = $category->id; view()->share('active_category', $category_id); view()->share('seo_title', 'Категория: ' . $category->seo_title); view()->share('seo_description', $category->seo_description); view()->share('seo_keywords', $category->seo_keywords); Title::prepend('Категория'); Title::prepend($category->seo_title); } else { Title::append(Conf::get('seo.default.seo_title')); $category = null; $category_id = null; } $q = request('q', null); if (!empty($q)) { } $posts = Posts::i()->getPostsByCategoryId($category_id, $q); $data = ['posts' => $posts, 'category' => $category, 'q' => $q, 'title' => Title::renderr(' : ', true)]; return view('site.posts.index', $data); }
public function index($slug = '') { if ($slug != '') { $category = Categories::i()->getBySlug($slug); if (empty($category)) { abort(404); } $category_id = $category->id; View::share('active_category', $category_id); View::share('seo_title', 'Категория: ' . $category->seo_title); View::share('seo_description', $category->seo_description); View::share('seo_keywords', $category->seo_keywords); $this->title->prepend('Категория: ' . $category->seo_title); } else { $category = null; $category_id = null; } $data = ['posts' => Posts::i()->getPostsByCategoryId($category_id), 'category' => $category]; return view('site.posts.index', $data); }