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


PHP Category::tree方法代码示例

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


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

示例1: getFilterCategory

 public function getFilterCategory($id)
 {
     $categories = [0 => 'Все'];
     foreach (Category::all() as $category) {
         $categories[$category->id] = $category->name;
     }
     return view('admin.products.index', ['products' => Product::where('category_id', '=', $id)->paginate(15), 'categories' => Category::tree()]);
 }
开发者ID:venomir,项目名称:tc,代码行数:8,代码来源:ProductController.php

示例2: function

<?php

// Home
Route::get('/', ['uses' => 'HomeController@index', 'as' => 'home']);
View::composer('partials.menu', function ($view) {
    $view->with('menuitems', \App\Models\Menu::orderBy('weight')->get());
});
View::composer('partials.categories', function ($view) {
    $view->with('categories', \App\Models\Category::tree());
});
View::composer('banners.index', function ($view) {
    $view->with('banners', \App\Models\Banner::all());
});
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController', 'products' => 'ProductController', 'user' => 'UserController', 'cart' => 'CartController']);
Route::group(['middleware' => ['auth']], function () {
    Route::controllers(['order' => 'OrderController', 'user' => 'UserController']);
});
/* < Admin > */
Route::get('admin', function () {
    return Redirect::to('admin/products');
});
Route::get('/ipn', 'Robokassa\\RobokassaController@getResult');
Route::post('/create_payment', 'Robokassa\\PaymentController@createPayment');
Route::group(['middleware' => ['auth', 'admin']], function () {
    Route::controllers(['admin/orders' => 'Admin\\OrderController', 'admin/order_products' => 'Admin\\OrderProductController', 'admin/categories' => 'Admin\\CategoryController', 'admin/products' => 'Admin\\ProductController', 'admin/productimage' => 'Admin\\ProductImageController', 'admin/users' => 'Admin\\UserController', 'admin/menu' => 'Admin\\MenuController', 'admin/currency' => 'Admin\\CurrencyController', 'admin/slider' => 'Admin\\SliderController', 'admin/blocks_content' => 'Admin\\BlocksContentController', 'admin/blocks_content_products' => 'Admin\\BlocksContentProductsController', 'admin/stat' => 'Admin\\StatisticController', 'admin/banners' => 'Admin\\BannerController']);
});
/* </ Admin > */
Route::any("/{slug}", array("as" => "content", "uses" => "MenuController@content"));
开发者ID:venomir,项目名称:tc,代码行数:28,代码来源:routes.php

示例3: index

 public function index($slug = null)
 {
     $category = Category::findBySlug($slug)->first();
     $products = Product::categorized($category)->paginate(8);
     return view('admin.products.index')->with('categories', Category::tree())->with('products', $products);
 }
开发者ID:ninjamonz,项目名称:laravel_catalog_example,代码行数:6,代码来源:ProductsController.php

示例4: getIndex

 public function getIndex()
 {
     return view('admin.categories.index', ['categories' => Category::tree()]);
 }
开发者ID:venomir,项目名称:tc,代码行数:4,代码来源:CategoryController.php

示例5: getCategories

 public function getCategories()
 {
     return view('admin.categories.index')->with('categories', Category::tree());
 }
开发者ID:ninjamonz,项目名称:laravel_catalog_example,代码行数:4,代码来源:CategoriesController.php


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