public function update(Requests\ProductRequest $request, $id)
 {
     $this->productModel->findOrNew($id)->update($request->all());
     $input = array_map('trim', explode(',', $request->get('tags')));
     $this->storeTag($input, $id);
     return redirect()->route('products')->with('product_update', 'Product updated!');
 }
Exemplo n.º 2
0
 public function update(Requests\ProductRequest $request, $id)
 {
     $this->model->find($id)->update($request->all());
     $product = $this->model->find($id);
     $product->tags()->sync($this->getTagsIds($request->tags));
     return redirect('admin/products');
 }
 public function update(Requests\ProductRequest $request, $id)
 {
     $product = $this->productModel->find($id);
     $product->update($request->all());
     $this->saveTags($product, $request->input('tags'));
     return redirect()->route('products');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param ProductRequest $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(ProductRequest $request, $id)
 {
     $product = $this->model->find($id);
     $product->update($request->all());
     $product->tags()->sync($this->syncTags($request->tagList));
     return redirect()->route('products.index');
 }
 public function update(ProductRequest $request, $id)
 {
     $inputs = $request->all();
     $this->product_model->find($id)->update($inputs);
     $this->storeTags($inputs['tags'], $id);
     return redirect()->route('admin.products');
 }
Exemplo n.º 6
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Requests\ProductRequest $request, $id)
 {
     $input = $request->all();
     $product = $this->productModel->find($id);
     $product->update($input);
     return redirect()->route('products');
 }
 public function update(Requests\ProductRequest $request, $id)
 {
     $input = $request->all();
     $input['featured'] = isset($input['featured']) ? true : false;
     $input['recommend'] = isset($input['recommend']) ? true : false;
     $this->productModel->find($id)->update($input);
     return redirect()->route('products.index');
 }
 public function update(ProductRequest $request, Tag $tag, $id)
 {
     $tagsProduto = $tag->criaTags($request->only('tags')['tags']);
     $produto = $this->product->find($id);
     $produto->update($request->all());
     $produto->tags()->sync($tagsProduto);
     return redirect()->route('admin.products');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\ProductRequest $request, $id)
 {
     $product = $this->products->find($id);
     $tags = $this->storeTags($request->input('tags'));
     $product->update($request->all());
     $product->tags()->sync($tags);
     return redirect()->route('products');
 }
 public function update(Requests\ProductRequest $request, \CodeCommerce\Product $product)
 {
     $product->featured = null;
     $product->recommend = null;
     $tagIds = $this->getTagIds($request->get('tags'));
     $product->update($request->all());
     $product->tags()->sync($tagIds);
     return redirect()->route('products.index');
 }
Exemplo n.º 11
0
 public function update(Requests\ProductRequest $request, $id)
 {
     $input = $request->all();
     $product = $this->productModel->find($id);
     $product->update($input);
     $tags = $request->tags;
     $t = $this->addTags($product, $tags);
     return redirect()->route('products.index');
 }
 public function update(Requests\ProductRequest $request, $id)
 {
     $input = $request->all();
     $input['featured'] = isset($input['featured']) ? 1 : 0;
     $input['recommend'] = isset($input['recommend']) ? 1 : 0;
     $product = $this->model->find($id);
     $product->update($input);
     return redirect()->route('products');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Requests\ProductRequest $request)
 {
     $input = $request->except('tag');
     $imputTag = $request->input('tag');
     $tags = explode(',', $imputTag);
     $products = $this->productModel->fill($input);
     $products->save();
     $this->storeTag($tags, $products->id);
     return redirect()->route('products.index');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\ProductRequest  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\ProductRequest $request, $id)
 {
     $input = $request->all();
     $input['featured'] = $request->get('featured') ? true : false;
     $input['recommend'] = $request->get('recommend') ? true : false;
     $arrayTags = $this->tagToArray($input['tags']);
     $this->productModel->find($id)->update($input);
     $product = Product::find($id);
     $product->tags()->sync($arrayTags);
     return redirect()->route('admin.products.index');
 }
Exemplo n.º 15
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update(Requests\ProductRequest $request, $id)
 {
     $input = $request->all();
     if (!array_key_exists('featured', $input)) {
         $input['featured'] = 0;
     }
     if (!array_key_exists('recommend', $input)) {
         $input['recommend'] = 0;
     }
     $this->productModel->find($id)->update($input);
     return redirect()->route('products');
 }
 public function update(ProductRequest $request, $id)
 {
     $product = $this->productModel->find($id);
     $product->update($request->except('tags_prod'));
     if ($request->has('tag_list')) {
         $this->tagsControl($product, $request->input('tag_list'), false);
     } else {
         if (count($product->tags) > 0) {
             $product->tags()->detach();
         }
     }
     return redirect()->route('products.index');
 }
 /**
  * processar dados do post e salvar em model
  */
 public function store(Requests\ProductRequest $request)
 {
     $input = $request->all();
     $product = $this->products->fill($input);
     //dados do request passados para o model
     //        $product->recommend = $request->input('recommend',false);//preencher checkbox caso  = false outra solucao ao hidden
     //        $product->featured = $request->input('featured',false);//preencher checkbox caso  = false
     $product->save();
     //persiste no banco
     $tagNames = explode(',', $input['tags']);
     $tagIds = $this->storeTags($tagNames, $product->id);
     //armazena novas tags e mantem as atuais
     flash('Produto salvo com sucesso. - ' . $product->name);
     //flash message teste
     return redirect()->route('admin.products.index');
 }
 public function update(Requests\ProductRequest $request, $id)
 {
     $input = $request->all();
     $tags_update = array_map('trim', explode(',', $input['tags']));
     $array_update_tags = array();
     foreach ($tags_update as $tag) {
         if (!empty($tag)) {
             if (!in_array($tag, Tag::lists('name')->toArray())) {
                 Tag::create(['name' => $tag]);
             }
             array_push($array_update_tags, Tag::lists('id', 'name')->toArray()[$tag]);
         }
     }
     $this->productModel->find($id)->update($input);
     $this->productModel->find($id)->tags()->sync($array_update_tags);
     return redirect()->route('admin.products.index');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\ProductRequest $request, $id)
 {
     $request['featured'] = $request->get('featured');
     $request['recommended'] = $request->get('recommended');
     $this->model->find($id)->update($request->all());
     $product = $this->model->find($id);
     $product->tags()->sync($this->getTagsIds($request->tags));
     $product->colors()->sync($this->getColorsIds($request->color));
     return redirect()->route('admin.products');
 }
 public function store(Requests\ProductRequest $request)
 {
     $params = $request->all();
     $product = $this->produto->fill($params);
     $product->save();
     /*$tagBanco = new Tag();
             $tags = $params['tags'];
             $tags = explode(',',$tags);
             $tags = array_map('trim',$tags);
     
             $tagCollection = [];
             foreach($tags as $tag)
             {
                 $t = $tagBanco->firstOrCreate(['name'=>$tag]);
                 array_push($tagCollection,$t->id);
             }
             */
     $tags = $params['tags'];
     $tagsProduct = $product->tagToArray($tags);
     $product->tags()->sync($tagsProduct);
     return redirect()->route('admin.products');
 }
    /**
     * Update the specified resource in storage.
     *
     * @param  Request $request
     * @param  int $id
     * @return Response
     */
    public function update(Requests\ProductRequest $request, $id)
    {
        $input = $request->all();

        $input['featured'] = isset($input['featured']) ? 1 : 0;

        $input['recommend'] = isset($input['recommend']) ? 1 : 0;

        //$this->productModel->find($id)->update($input);

        $product = $this->productModel->find($id);

        $product->update($input);

        $product->tags()->sync($this->getTagIds($request->tags));

        return redirect()->route('admin.products');
    }
 /**
  * Update the specified resource in storage.
  *
  * @param ProductRequest|Pro $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(ProductRequest $request, $id)
 {
     $this->product->find($id)->update($request->all());
     /**
      * Sync Tags
      */
     $this->product->find($id)->tags()->sync($this->getTagIds($request->tag_list));
     return redirect()->route('admin.products');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\ProductRequest $request, Tag $tagModel, $id)
 {
     $product = $this->product->find($id);
     $data = $request->all();
     $tags = explode(',', str_replace(', ', ',', $data['tags']));
     $relatedTags = [];
     $product->update($data);
     foreach ($tags as $tag) {
         $tag = ucfirst(strtolower($tag));
         $thisTag = $tagModel->firstOrCreate(['name' => $tag]);
         echo $tag;
         $relatedTags[] = $thisTag->id;
     }
     $product->tags()->sync($relatedTags);
     return redirect()->route('products.index');
 }
 public function update(Requests\ProductRequest $request, $id)
 {
     $this->productModel->find($id)->update($request->all());
     return redirect()->route('admin.products.index');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Requests\ProductRequest $request, $id)
 {
     $product = $this->productModel->find($id);
     $product->fill($request->all())->save();
     $tags = $this->tags_to_array($request->get('taglist'));
     $product->tags()->sync($tags);
     return redirect()->route('admin.products');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update($id, Requests\ProductRequest $request)
 {
     $input = array_map('trim', $request->all());
     if ($input['recommend'] == "on") {
         $input['recommend'] = 1;
     } else {
         $input['recommend'] = 0;
     }
     if ($input['featured'] == "on") {
         $input['featured'] = 1;
     } else {
         $input['featured'] = 0;
     }
     $tags = trim($request->input('tag'));
     $tags = array_filter(explode(",", $tags));
     $tags = array_filter($tags, 'trim');
     $arrTags = array();
     foreach ($tags as $t) {
         $tagAtual = Tag::firstOrCreate(array('name' => trim($t)));
         array_push($arrTags, $tagAtual->id);
     }
     $product = $this->productModel->find($id);
     $arrTrim = array_map('trim', $arrTags);
     $product->tags()->sync($arrTrim);
     $product->update($input);
     return redirect()->route('product');
 }
Exemplo n.º 27
0
 /**
  * Update the specified resource in storage.
  *
  * @param ProductRequest|Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(ProductRequest $request, $id)
 {
     $this->product->find($id)->update($request->all());
     $this->syncTags($request->get('tag_list'), $id);
     return redirect()->route('admin.products.index');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\ProductRequest $request, $id)
 {
     $this->productModel->find($id)->update($request->all());
     $this->insere_tags($request->tags, $id);
     return redirect()->route('listproduct');
 }
 public function update(Requests\ProductRequest $request, $id)
 {
     $this->productModel->findOrNew($id)->update($request->all());
     return redirect()->route('products');
 }
 public function update(Requests\ProductRequest $request, $id)
 {
     // Atualiza os dados no banco
     $this->productModel->find($id)->update($request->all());
     return redirect()->route('products');
 }