Esempio n. 1
0
 /**
  * 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 AttributeRepository $attributes
  * @param AttributeValueRepository $values
  * @return Attribute
  */
 public function handle(AttributeRepository $attributes, AttributeValueRepository $values)
 {
     $attribute = $attributes->findById($this->id)->fill($this->getProperties());
     $attributes->save($attribute);
     if ($this->add_value) {
         $value = AttributeValue::register($attribute->id, $this->add_value);
         $values->save($value);
     }
     return $attribute;
 }
 /**
  * Execute the command.
  *
  * @param AttributeRepository $attributes
  * @return Paginator
  */
 public function handle(AttributeRepository $attributes)
 {
     return $attributes->query($this->q);
 }
 /**
  * Execute the command.
  *
  * @param AttributeRepository $attributes
  * @return Attribute
  */
 public function handle(AttributeRepository $attributes)
 {
     $attribute = Attribute::register($this->description, $this->type);
     $attributes->save($attribute);
     return $attribute;
 }