/** * Execute the command. * * @param ProductTypeRepository $types * @return ProductType */ public function handle(ProductTypeRepository $types) { $type = $types->findById($this->id)->fill($this->getProperties()); $types->save($type); $type->attributes()->sync($this->attributes); return $type; }
/** * Show the form for editing the specified resource. * * @param int $id * @param ProductTypeRepository $types * @param AttributeRepository $attributes * @return Response */ public function edit($id, ProductTypeRepository $types, AttributeRepository $attributes) { try { return view('product-types.edit')->with('model', $types->findById($id, true))->with('attributes', $attributes->all()); } catch (ModelNotFoundException $e) { flash()->warning(trans('product-types.not_found')); return redirect()->route('product-type.index'); } }