Пример #1
0
 /**
  * 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;
 }
Пример #2
0
 /**
  * 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;
 }