本文整理汇总了PHP中app\models\Categories::i方法的典型用法代码示例。如果您正苦于以下问题:PHP Categories::i方法的具体用法?PHP Categories::i怎么用?PHP Categories::i使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Categories
的用法示例。
在下文中一共展示了Categories::i方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
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);
}
示例2: compose
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);
}
示例3: index
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);
}
示例4: index
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);
}
示例5: index
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);
}