Exemplo n.º 1
0
 public function create($name)
 {
     Assertion::string($name);
     $tag = new Tag(['name' => $name, 'slug' => Str::slug($name)]);
     $tag->author()->associate($this->context->context());
     $this->tags->add($tag);
     return $tag;
 }
Exemplo n.º 2
0
 public function create($name, $price, $active, $thumb, $content)
 {
     Assertion::string($name);
     Assertion::boolean($active);
     $product = new Product(['name' => $name, 'slug' => Str::slug($name), 'price' => $price, 'active' => $active, 'content' => $content, 'thumb' => $thumb]);
     $product->author()->associate($this->context->context());
     $this->products->add($product);
     return $product;
 }