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


PHP ProductCategory::getSource方法代碼示例

本文整理匯總了PHP中ProductCategory::getSource方法的典型用法代碼示例。如果您正苦於以下問題:PHP ProductCategory::getSource方法的具體用法?PHP ProductCategory::getSource怎麽用?PHP ProductCategory::getSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ProductCategory的用法示例。


在下文中一共展示了ProductCategory::getSource方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: editProduct

 public function editProduct($productId)
 {
     try {
         $product = Product::with('images')->with('categories')->with('optionGroups')->with('options')->with('priceBreaks')->with('sizeLists')->findorFail($productId);
     } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         return App::abort(404);
     }
     $product = $product->toArray();
     foreach (['option_groups', 'options'] as $value) {
         $tmpData = [];
         if (!empty($product[$value])) {
             foreach ($product[$value] as $v) {
                 $tmpData[] = $v['id'];
             }
         }
         $product[$value] = $tmpData;
         unset($tmpData);
     }
     $product['sell_price'] = number_format($product['sell_price'], 2);
     $arrCategories = [];
     if (!empty($product['categories'])) {
         foreach ($product['categories'] as $category) {
             $arrCategories[] = $category['id'];
         }
     }
     $this->layout->title = 'Edit Product';
     $this->layout->content = View::make('admin.products-one')->with(['product' => $product, 'arrCategories' => ProductCategory::getSource(false, 0, true), 'arrChosenCategories' => $arrCategories, 'types' => ProductType::getSource(), 'option_groups' => ProductOptionGroup::getSource(false, true), 'layouts' => array()]);
 }
開發者ID:nguyendaivu,項目名稱:imagestock,代碼行數:28,代碼來源:ProductsController.php

示例2: editProductCategory

 public function editProductCategory($id)
 {
     try {
         $category = ProductCategory::with('images')->findorFail($id);
     } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         return App::abort(404);
     }
     $category = $category->toArray();
     $category['images'] = reset($category['images']);
     $this->layout->title = 'Edit Product Category';
     $this->layout->content = View::make('admin.product-categories-one')->with(['category' => $category, 'parent' => ProductCategory::getSource(false, $id)]);
 }
開發者ID:nguyendaivu,項目名稱:imagestock,代碼行數:12,代碼來源:ProductCategoriesController.php


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