当前位置: 首页>>代码示例>>PHP>>正文


PHP Category::whereDepth方法代码示例

本文整理汇总了PHP中app\Category::whereDepth方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::whereDepth方法的具体用法?PHP Category::whereDepth怎么用?PHP Category::whereDepth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Category的用法示例。


在下文中一共展示了Category::whereDepth方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: categories

 public function categories()
 {
     $view = Input::get('view');
     if ($view == null) {
         return redirect('/admin/categories?view=hierarchy');
     }
     $levels = ['Main Category', 'Subcategory', 'Post Sub Category'];
     $types = ['main-categories', 'sub-categories', 'post-sub-categories'];
     $views = ['Hierarchy', 'Type', 'All'];
     $cats = Category::roots()->get();
     $category = Input::get('category');
     $_category = Category::find($category);
     if ($view == 'type') {
         $type = Input::get('type');
         if ($type == null) {
             $type = $types[0];
         }
         // array_keys() = get keys from value
         // appends() = add 'get' variables (to url)
         $cats = Category::whereDepth(array_keys($types, $type))->paginate(25)->appends(Input::except('page'));
     } else {
         if ($view == 'all') {
             $cats = Category::paginate(25)->appends(Input::except('page'));
         }
     }
     return view('admin.main')->with('category', $_category)->with('cats', $cats)->with('levels', $levels)->with('view', $view)->with('views', $views)->with('types', $types);
     // only for 'type' view
 }
开发者ID:bluecipherz,项目名称:gl-ct,代码行数:28,代码来源:AdminPanelController.php

示例2: getSubCatSet

 public function getSubCatSet()
 {
     $catarray = [];
     $cats = Category::whereDepth(1)->get();
     $counter = 0;
     for ($col = 0; $col < 3; $col++) {
         $fillmore = true;
         $row = 0;
         $colarray = [];
         while ($fillmore) {
             if (isset($cats[$counter])) {
                 $colarray[$row] = ['id' => $cats[$counter]->id, 'name' => $cats[$counter]->name];
             } else {
                 break;
             }
             $row++;
             $counter++;
             if ($row > 11) {
                 $fillmore = false;
             }
         }
         $catarray[$col] = $colarray;
     }
     return $catarray;
 }
开发者ID:bluecipherz,项目名称:gl-ct,代码行数:25,代码来源:HomeRepository.php

示例3: __construct

 public function __construct()
 {
     //        $productQuery = Globex::with('images')->select('id', 'title', 'description', 'price', DB::raw('0 as type'));
     //        $adQuery = Advertisement::with('images')->select('id', 'title', 'description','price', DB::raw('1 as type'));
     //        $motorQuery = Motor::with('images')->select('id', 'title', 'description','price', DB::raw('2 as type'));
     //        $this->products = $adQuery->get()->merge($productQuery->get())->merge($motorQuery->get());
     $this->products = Product::with('producible')->get();
     $this->emirates = Emirate::all();
     $this->cats = Category::whereDepth(0)->get();
 }
开发者ID:bluecipherz,项目名称:gl-ct,代码行数:10,代码来源:CoreComposer.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $data = ['myads' => Auth::customer()->get()->advertisements, 'cats' => Category::whereDepth(2)->lists('name', 'id')];
     return view('pages.myads', $data);
 }
开发者ID:bluecipherz,项目名称:gl-ct,代码行数:10,代码来源:AdvertisementController.php

示例5: getSubCats

 public function getSubCats()
 {
     return Category::whereDepth(1)->get();
 }
开发者ID:bluecipherz,项目名称:gl-ct,代码行数:4,代码来源:CategoryRepository.php


注:本文中的app\Category::whereDepth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。