本文整理汇总了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()]);
}
示例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"));
示例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);
}
示例4: getIndex
public function getIndex()
{
return view('admin.categories.index', ['categories' => Category::tree()]);
}
示例5: getCategories
public function getCategories()
{
return view('admin.categories.index')->with('categories', Category::tree());
}