當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Category::getSortedCategories方法代碼示例

本文整理匯總了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'));
 }
開發者ID:ambarsetyawan,項目名稱:laravel5-blog-1,代碼行數:13,代碼來源:CategoriesController.php

示例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'));
     });
 }
開發者ID:kpaxer,項目名稱:laravel-blog,代碼行數:10,代碼來源:ViewComposerServiceProvider.php

示例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'));
     });
 }
開發者ID:ambarsetyawan,項目名稱:laravel5-blog-1,代碼行數:12,代碼來源:ViewComposerServiceProvider.php

示例4: index

 public function index()
 {
     $categories = Category::getSortedCategories();
     return view('admin.categories.index', compact('categories'));
 }
開發者ID:hushibing,項目名稱:laravel51,代碼行數:5,代碼來源:CategoryController.php

示例5: categories

 public function categories()
 {
     return Category::getSortedCategories();
 }
開發者ID:hushibing,項目名稱:laravel51,代碼行數:4,代碼來源:BaseController.php


注:本文中的app\Category::getSortedCategories方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。