/**
  * Store a newly created resource in storage.
  *
  * @param ProductRequest|Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(ProductRequest $request)
 {
     $input = $request->all();
     $product = $this->product->fill($input);
     $product->save();
     $this->syncTags($request->get('tag_list'), $product->id);
     return redirect()->route('admin.products.index');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(ProductRequest $request)
 {
     $this->product->fill($request->all());
     $this->product->save();
     /**
      * Sync Tags
      */
     $this->product->tags()->sync($this->getTagIds($request->tag_list));
     return redirect()->route('admin.products');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\ProductRequest $request, Tag $tagModel)
 {
     $data = $request->all();
     $tags = explode(',', str_replace(', ', ',', $data['tags']));
     $product = $this->product->fill($data);
     $relatedTags = array();
     $product->save();
     foreach ($tags as $tag) {
         $tag = ucfirst(strtolower($tag));
         $thisTag = $tagModel->firstOrCreate(['name' => $tag]);
         $relatedTags[] = $thisTag->id;
     }
     $product->tags()->sync($relatedTags);
     return redirect()->route('products.index');
 }