Exemplo n.º 1
0
 public function add()
 {
     $prod_types = [];
     $prodTy = ProductType::get(['id', 'type'])->toArray();
     foreach ($prodTy as $prodT) {
         $prod_types[$prodT['id']] = $prodT['type'];
     }
     $attr_sets = [];
     $attrS = AttributeSet::get(['id', 'attr_set'])->toArray();
     foreach ($attrS as $attr) {
         $attr_sets[$attr['id']] = $attr['attr_set'];
     }
     $action = route("admin.products.save");
     return view(Config('constants.adminProductView') . '.add', compact('prod_types', 'attr_sets', 'action'));
 }
Exemplo n.º 2
0
 public function getFormEdit($id)
 {
     $data = array();
     $input = Product::find($id);
     if (is_null($input)) {
         return Redirect::route('admin.product');
     }
     $categories = ProductType::get();
     $data['action'] = "Edit";
     $data['input'] = Input::old();
     if (!$data['input']) {
         $data['input'] = $input;
     } else {
         $data['input']['image'] = $input['image'];
     }
     $data['category'] = $categories;
     $data['formProcess'] = "editProcess";
     return View::make('admin.site.form.product', $data);
 }
Exemplo n.º 3
0
 public function add()
 {
     $prod_types = [];
     $prodTy = ProductType::get(['id', 'type'])->toArray();
     foreach ($prodTy as $prodT) {
         $prod_types[$prodT['id']] = $prodT['type'];
     }
     $attr_sets = [];
     $attrS = AttributeSet::get(['id', 'attr_set'])->toArray();
     foreach ($attrS as $attr) {
         $attr_sets[$attr['id']] = $attr['attr_set'];
     }
     //
     //        $brandCats = [];
     //        $brands = Category::findBySlug("brand-name")->getDescendants(1, ['id', 'category'])->toHierarchy()->toArray();
     //        foreach ($brands as $brand) {
     //            $brandCats[$brand['id']] = $brand['category'];
     //        }
     $action = route("admin.products.save");
     return view(Config('constants.adminProductView') . '.add', compact('prod_types', 'attr_sets', 'action'));
 }