/** * Store a newly created resource in storage. * * @return Response */ public function store(Requests\Products $request) { Product::create($request->all()); Session::flash('flash_message', 'Product added!'); return redirect('products'); }
/** * Update the specified resource in storage. * * @param int $id * * @return Response */ public function update($id, Products $request) { $product = Product::findOrFail($id); $all = $request->all(); if (isset($all['image'])) { $this->unlink($product['image']); $all['image'] = $this->upload($all['image']); } $product->update($all); Session::flash('flash_message', 'Product updated!'); return redirect('products-grid/' . $id); }