Update the specified resource in storage.

@param \AvoRed\Ecommerce\Http\Requests\ProductRequest $request
@param int $id

@return \Illuminate\Http\RedirectResponse|\Exception
167809
public function update(ProductRequest $request, ProductModel $product)
    {
        //dd($request->all());
        try {
            //$product = ProductModel::findorfail($id);
            $product->saveProduct($request->all());
        } catch (\Exception $e) {
            throw new \Exception('Error in Saving Product: ' . $e->getMessage());
        }

        return redirect()->route('admin.product.index');
    }
969090
public function update($id, PromotionRequest $request)
    {
        $promotion = $this->repository->find($id);

        if (empty($promotion)) {
            Cms::notification('Promotions not found', 'warning');

            return redirect(route($this->routeBase.'.promotions.index'));
        }

        $promotion = $this->repository->update($promotion, $request->all());

        Cms::notification('Promotions updated successfully.', 'success');

        return redirect(url()->previous());
    }
551389
public function updateAction(ProductItemField $productitemfield, Request $request)
    {
        $editForm = $this->createForm($this->get("amulen.shop.form.product.item.field"), $productitemfield, array(
            'action' => $this->generateUrl('admin_productitemfield_update', array('id' => $productitemfield->getid())),
            'method' => 'PUT',
        ));
        if ($editForm->handleRequest($request)->isValid()) {
            $productitemSrv = $this->get('amulen.shop.product.item.field');
            $productitemSrv->uploadImage($productitemfield);
            $this->getDoctrine()->getManager()->flush();

            return $this->redirect($this->generateUrl('admin_productitemfield_show', array('id' => $productitemfield->getId())));
        }
        return $this->redirect($this->generateUrl('admin_productitemfield_show', array('id' => $productitemfield->getId())));
    }
1218313
public function putAction(Request $request, $productId)
    {
        $locale = $request->get('locale');
        $parameters = $request->request->all();

        $product = $this->fetchProduct($productId);

        $content = $this->getProductContentMapper()->map($product, $parameters, $locale);
        $this->getEntityManager()->flush();

        $view = $this->view($content, Response::HTTP_OK);

        return $this->handleView($view);
    }
1134711
public function update(Request $request, $id)
    {
        $this->validate(
            $request,
            [
                'name' => 'required',
                'email' => 'required|string|max:255|email|unique:users,email,' . $id,
                'roles' => 'required'
            ]
        );

        $data = $request->except('password');
        if ($request->has('password')) {
            $data['password'] = bcrypt($request->password);
        }

        $user = User::findOrFail($id);
        $user->update($data);

        $user->roles()->detach();
        foreach ($request->roles as $role) {
            $user->assignRole($role);
        }

        return redirect('admin/users')->with('flash_message', 'User updated!');
    }
685843
public function update(Request $request, $id)
    {
        $this->roles->findOrFail($id)->update($request->only('name', 'label'));
        return \Redirect::route('admin.roles.index', [
         ])->withMessage(trans('acl::role.roles-controller-successfully_updated'));
    }
1200196
public function patchAction(Request $request, $id)
    {
        $locale = $this->getProductLocaleManager()->retrieveLocale($this->getUser(), $request->get('locale'));

        try {
            $product = $this->getManager()->partialUpdate(
                $request->request->all(),
                $locale,
                $this->getUser()->getId(),
                $id
            );

            $this->getEntityManager()->flush();

            $view = $this->view($product, 200);
        } catch (ProductNotFoundException $exc) {
            $exception = new EntityNotFoundException($exc->getEntityName(), $exc->getId());
            $view = $this->view($exception->toArray(), 404);
        }

        return $this->handleView($view);
    }
856823
public function update(Request $request, $id)
    {
        $this->validate($request, [
            'title' => 'required|min:2',
            'description' => 'min:2',
            'deprecated' => 'boolean',
        ]);

        $book = $this->model->findOrFail($id);

        if (! $book->update($request->all())) {
            return json()->internalError('Failed to update !');
        }

        return json()->success('Updated');
    }
10910
public function update(SeoPagesRequest $request, $id)
    {
        $input = $request->all();

        $record = $this->model->findOrFail($id);

        $record->update($input);

        $this->notify([
            'type' => 'success',
            'title' => 'Successful update!',
            'description' => 'SeoPage is updated successfully.',
        ]);

        return redirect()->back();
    }
604221
public function update(int $id, Request $request)
    {
        $attachment = Attachment::findOrFail($id)
            ->fill($request->all());

        $attachment->save();

        return response()->json($attachment);
    }
1168971
public function update (Request $request , $id)
    {
        if ($category = $this->category->where('id' , $id)->first()) {

            foreach ($request->except(['_token']) as $key => $val) {
                if (Schema::hasColumn('categories' , $key))
                    $category->{$key} = $val;
            }

            $slug = new Slugger($this->modelType);
            $slug = $slug->updateSlug($category , $request->input('slug') , $request->input('title'));
            $category->slug = $slug;

            $category->save();
            return $category;
        } else
            throw new CategoryException(trans('Categories::category.error-message.categoryNotExist'));

    }
1182324
public function update(Request $request, $id)
    {
        try {
            $role = $this->roles->save($request, $id);
        } catch (Exception $e) {
            return $this->handleException($e, trans('soda::errors.update', ['object' => 'role']));
        }

        return redirect()->route('soda.roles.edit', $role->getKey())->with('success', trans('soda::messages.updated', ['object' => 'role']));
    }
109842
public function update(Request $request, $id)
    {
        $this->validate($request, [
			'title' => 'required',
			'content' => 'required'
		]);
        $requestData = $request->all();
        
        $page = Page::findOrFail($id);
        $page->update($requestData);

        return redirect('admin/pages')->with('flash_message', 'Page updated!');
    }
1096764
public function putAction(Request $request, $id)
    {
        $this->checkAccess('PUT', $id);
        $resource = $this->getResourceManager()->find($id);
        return $this->processPut($request, $resource);
    }
473072
public function update(LessonUpdateRequest $request, $id)
    {
        try {
            $this->validator->with($request->all())->passesOrFail(ValidatorInterface::RULE_UPDATE);

//            $lesson = $this->repository->update($id, $request->all());

            $lesson = $this->repository->update($request->all(), $id);

            $response = [
                'message' => 'Lesson updated.',
                'data'    => $lesson->toArray(),
            ];

            if ($request->wantsJson()) {
                return response()->json($response);
            }

            return redirect()->back()->with('message', $response['message']);
        } catch (ValidatorException $e) {
            if ($request->wantsJson()) {
                return response()->json([
                    'error'   => true,
                    'message' => $e->getMessageBag()
                ]);
            }

            return redirect()->back()->withErrors($e->getMessageBag())->withInput();
        }
    }
932746
public function update(Request $request, $id)
    {
        try {
            $this->permissionRepositoryInterface->update($request->all(), $id);
        } catch (FormValidationException $e) {
            Flash::error($e->getMessage());

            return redirect()
              ->route('permissions.edit', ['id' => $id])
              ->withErrors($e->getErrors())
              ->withInput();
        } catch (PermissionsException $e) {
            Flash::error($e->getMessage());

            return redirect()->route('permissions.index');
        }

        Flash::success(trans('dashboard::dashboard.flash.permission.edit.success'));

        return redirect()->route('permissions.edit', ['id' => $id]);
    }
3028
public function update($id, Request $request)
    {
        //BUSCAR ID
        $post = $this->noticiaRepo->findOrFail($id);

        //VALIDACION DE DATOS
        $this->validate($request, $this->rules);

        //VARIABLES
        $titulo = $request->input('titulo');
        $slug_url = SlugUrl($titulo);
        $categoria = $request->input('categoria');
        $tags = $request->input('tags');

        //GUARDAR DATOS
        $post->slug_url = $slug_url;
        $post->categoria_id = $categoria;
        $row = $this->noticiaRepo->update($post, $request->all());

        //GUARDAR TAGS
        ($tags <> '') ? $row->tags()->sync($tags) : false;

        //MENSAJE
        flash()->success('El registro se actualizó satisfactoriamente.');

        //REDIRECCIONAR A PAGINA PARA VER DATOS
        return redirect()->route('admin.noticias.index');
    }