本文整理汇总了PHP中app\Category::getSortedCategories方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::getSortedCategories方法的具体用法?PHP Category::getSortedCategories怎么用?PHP Category::getSortedCategories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Category
的用法示例。
在下文中一共展示了Category::getSortedCategories方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
// $num_per_page=env('num_per_page_admin');
// $categories = Category::getSortedCategories()->paginate($num_per_page);
//pagination are not possible with getSortedCategories...
$categories = Category::getSortedCategories();
return view('admin.cats.index', compact('categories'));
}
示例2: composeSidebar
private function composeSidebar()
{
view()->composer('home.partials.sidebar', function ($view) {
$allTags = \App\Tag::all();
$allCategories = \App\Category::getSortedCategories();
$NewestArticles = \App\Article::latest()->take(15)->get();
$hottestArticles = \App\Article::orderBy('click')->take(15)->get();
$view->with(compact('allTags', 'allCategories', 'NewestArticles', 'hottestArticles'));
});
}
示例3: composeSidebar
private function composeSidebar()
{
view()->composer('blog.partials.side', function ($view) {
$allCategories = \App\Category::getSortedCategories();
$NewestArticles = \App\Article::published()->orderBy('updated_at', 'desc')->take(10)->get();
$view->with(compact('allCategories', 'NewestArticles'));
});
view()->composer('home.partials.side', function ($view) {
$NewestArticles = \App\Article::published()->orderBy('updated_at', 'desc')->take(10)->get();
$view->with(compact('NewestArticles'));
});
}
示例4: index
public function index()
{
$categories = Category::getSortedCategories();
return view('admin.categories.index', compact('categories'));
}
示例5: categories
public function categories()
{
return Category::getSortedCategories();
}