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; }
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; }