/** * 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'); } }
/** * Execute the command. * * @param ProductTypeRepository $types * @return ProductType */ public function handle(ProductTypeRepository $types) { $type = ProductType::register($this->description); $types->save($type); return $type; }
/** * Show the form for creating a new resource. * * @param ProductTypeRepository $product_types * @return Response */ public function create(ProductTypeRepository $product_types) { return view('products.create')->with('product_types', $product_types->all()); }
/** * Execute the command. * * @param ProductTypeRepository $types * @return Collection */ public function handle(ProductTypeRepository $types) { return $types->query($this->q); }