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()]);
 }
 public function index()
 {
     $this->layout->title = 'Product Options';
     $this->layout->content = View::make('admin.product-options-all')->with(['option_group' => ProductOptionGroup::getSource(true)]);
 }