本文整理匯總了PHP中ProductCategory::live方法的典型用法代碼示例。如果您正苦於以下問題:PHP ProductCategory::live方法的具體用法?PHP ProductCategory::live怎麽用?PHP ProductCategory::live使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ProductCategory
的用法示例。
在下文中一共展示了ProductCategory::live方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: compose
public function compose($view)
{
$productCategories = ProductCategory::live()->get();
$items = array();
foreach ($productCategories as $productCategory) {
$items[$productCategory->getUrl()] = $productCategory->name;
}
$view->with('productCategories', $items);
}
示例2: stockists
public function stockists()
{
$productCategories = ProductCategory::live()->with(array('products' => function ($query) {
$query->live()->with(array('stockists' => function ($query) {
$query->live()->orderBy('order', 'asc');
}))->orderBy('name', 'asc');
}))->orderBy('order', 'asc')->get();
$stockists = Stockist::live()->with(array('products' => function ($query) {
$query->live()->orderBy('product_category_id', 'asc')->orderBy('name', 'asc');
}))->orderBy('order', 'asc')->get();
return \View::make(\Config::get('laravel-food::views.products.stockists'))->with(compact('productCategories', 'stockists'));
}
示例3: view
public function view($productCategorySlug)
{
$productCategory = ProductCategory::live()->where('slug', '=', $productCategorySlug)->first();
$products = Product::live()->where('product_category_id', '=', $productCategory->id)->orderBy('name', 'asc')->get();
return \View::make(\Config::get('laravel-food::views.product_categories.view'))->with(compact('productCategory', 'products'));
}