本文整理匯總了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();
}