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')); }
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); }
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')); }