Update the specified resource in storage.

@param  CartItem $cartitem
@param  UpdateCartItemRequest $request
@return Response
765899
public function update(CartItem $cartitem, UpdateCartItemRequest $request)
    {
        $this->cartitem->update($cartitem, $request->all());

        return redirect()->route('admin.cart.cartitem.index')
            ->withSuccess(trans('core::core.messages.resource updated', ['name' => trans('cart::cartitems.title.cartitems')]));
    }
1066856
public function updateAction(Request $request): JsonResponse
    {
        $id   = $request->request->get('id');
        $data = $request->request->get('product');
        
        try {
            $this->quickUpdateProduct($id, $data);
            $result = ['success' => $this->trans('product.flash.success.saved')];
        } catch (\Exception $e) {
            $result = ['error' => $e->getMessage()];
        }
        
        return $this->jsonResponse($result);
    }
1341094
protected function updateCart(array $order, array $cart)
    {
        foreach ($cart['items'] as $item) {

            $data = array(
                'user_id' => $order['user_id'],
                'order_id' => $order['order_id']
            );

            $this->cart->update($item['cart_id'], $data);
        }
    }
831819
public function update(OrderStatus $orderstatus, UpdateOrderStatusRequest $request)
    {
        $this->orderstatus->update($orderstatus, $request->all());

        return redirect()->route('admin.order.orderstatus.index')
            ->withSuccess(trans('core::core.messages.resource updated', ['name' => trans('order::orderstatuses.title.orderstatuses')]));
    }
1274067
public function update(ProductsRequest $request, $item)
	{
		$this->products->update(
			$request->all(), $item
		);

		return back()->with('status', trans('globals.success_text'));
	}
1149369
public function updateGalleryItemAction(Request $request, GalleryItem $entity, Product $product)
    {
        $em = $this->getDoctrine()->getManager();

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find GalleryItem entity.');
        }

        $deleteForm = $this->createDeleteGalleryItemForm($entity->getId());
        $editForm = $this->createEditGalleryItemForm($entity, $product);
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();

            return $this->redirect($this->generateUrl('admin_product_show', array('id' => $product->getId())));
        }

        return array(
            'entity' => $entity,
            'product' => $product,
            'edit_form' => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
32645
public function updateAction(Request $request)
    {
        $formData = $this->decodeRequest($request);

        // dump current profile configuration (to know what to remove later)
        /** @var Facet[] $facets */
        $facets = $this->om->getRepository('ClarolineCoreBundle:Facet\Facet')->findAll();

        $this->om->startFlushSuite();

        // updates facets data
        $updatedFacets = [];
        foreach ($formData as $facetData) {
            $updated = $this->crud->update(
                'Claroline\CoreBundle\Entity\Facet\Facet',
                $facetData,
                [Options::DEEP_DESERIALIZE]
            );
            $updatedFacets[$updated->getId()] = $updated;
        }

        // removes deleted facets
        foreach ($facets as $facet) {
            if (empty($updatedFacets[$facet->getId()])) {
                $this->crud->delete($facet);
            }
        }

        $this->om->endFlushSuite();

        return new JsonResponse(
            $this->serializer->serialize()
        );
    }
362934
public function updateItemsData($items)
    {
        $items->each(function ($item) {
            CartItem::where('id', $item->id)->update([
                'name' => $item->name,
                'price' => $item->price,
                'image' => $item->image,
            ]);
        });
    }
441004
public function update_item( $request ) {
		if ( isset( $request['parent'] ) ) {
			if ( ! is_taxonomy_hierarchical( $this->taxonomy ) ) {
				return new WP_Error( 'rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.' ), array( 'status' => 400 ) );
			}

			$parent = get_term( (int) $request['parent'], $this->taxonomy );

			if ( ! $parent ) {
				return new WP_Error( 'rest_term_invalid', __( "Parent resource doesn't exist." ), array( 'status' => 400 ) );
			}
		}

		$prepared_term = $this->prepare_item_for_database( $request );

		$term = get_term( (int) $request['id'], $this->taxonomy );

		// Only update the term if we haz something to update.
		if ( ! empty( $prepared_term ) ) {
			$update = wp_update_term( $term->term_id, $term->taxonomy, (array) $prepared_term );
			if ( is_wp_error( $update ) ) {
				return $update;
			}
		}

		$term = get_term( (int) $request['id'], $this->taxonomy );

		/* This action is documented in lib/endpoints/class-wp-rest-terms-controller.php */
		do_action( "rest_insert_{$this->taxonomy}", $term, $request, false );

		$schema = $this->get_item_schema();
		if ( ! empty( $schema['properties']['meta'] ) && isset( $request['meta'] ) ) {
			$meta_update = $this->meta->update_value( $request['meta'], (int) $request['id'] );
			if ( is_wp_error( $meta_update ) ) {
				return $meta_update;
			}
		}

		$fields_update = $this->update_additional_fields_for_object( $term, $request );
		if ( is_wp_error( $fields_update ) ) {
			return $fields_update;
		}

		$request->set_param( 'context', 'view' );
		$response = $this->prepare_item_for_response( $term, $request );
		return rest_ensure_response( $response );
	}
1215017
public function update(Request $request, $key)
    {
        $this->getFormRequestInstance();

        $model = $this->findFirstByKey($key);

        if (!$model) {
            return $this->validNotFoundJsonResponse();
        }

        DB::beginTransaction();
       
        try { 
            $instance = $this->repository->update($model, $request->all());
            $model = $instance[1];
            $mergedRequest = $this->uploadFiles($request, $model);
            $this->updateOrCreateRelations($mergedRequest, $model);
        } catch (\Exception $e) {
            DB::rollback();

            $message = $this->updateFailedMessage($key, $e->getMessage());
            throw new ResourceControllerException($message);
        }

        DB::commit();

        $message = $this->updateSuccessfulMessage($key);
        $data = [$model];

        return $this->validSuccessJsonResponse($message, $data);
    }
51608
protected function setItems($cartItems)
    {
        foreach ($cartItems as $cartItem) {
            $this->items->push(CartItem::createFrom($cartItem));
        }
    }
890706
public function updateAction(ProductItemFieldData $productitemfielddata, Request $request)
    {
        $editForm = $this->createForm($this->get("amulen.shop.form.product.item.field.data"), $productitemfielddata, array(
            'action' => $this->generateUrl('admin_productitemfielddata_update', array('id' => $productitemfielddata->getid())),
            'method' => 'PUT',
        ));
        if ($editForm->handleRequest($request)->isValid()) {
            $this->getDoctrine()->getManager()->flush();

            return $this->redirect($this->generateUrl('admin_productitemfielddata_show', array('id' => $productitemfielddata->getId())));
        }
        $deleteForm = $this->createDeleteForm($productitemfielddata->getId(), 'admin_productitemfielddata_delete');

        return array(
            'productitemfielddata' => $productitemfielddata,
            'edit_form' => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
503310
public function updateAction(Warehouse $warehouse, Request $request)
    {
        $editForm = $this->createForm(new WarehouseType(), $warehouse, array(
            'action' => $this->generateUrl('admin_warehouse_update', array('id' => $warehouse->getid())),
            'method' => 'PUT',
        ));
        if ($editForm->handleRequest($request)->isValid()) {
            $this->getDoctrine()->getManager()->flush();

            return $this->redirect($this->generateUrl('admin_warehouse_show', array('id' => $warehouse->getId())));
        }
        $deleteForm = $this->createDeleteForm($warehouse->getId(), 'admin_warehouse_delete');

        return array(
            'warehouse' => $warehouse,
            'edit_form' => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
1296583
public function updateAction(Request $request, Product $entity)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $this->addProductItemFieldData($entity);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Product entity.');
        }

        $deleteForm = $this->createDeleteForm($entity->getId());
        $editForm = $this->createEditForm($entity);
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            /* @var ProductRawMaterial $productRawMaterial */
            foreach ($entity->getRawMaterials() as $productRawMaterial) {
                $productRawMaterial->setProduct($entity);
            }
            $em->flush();

            return $this->redirect($this->generateUrl('admin_product_show', array('id' => $entity->getId())));
        }

        return array(
            'entity' => $entity,
            'edit_form' => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }
353701
public function update(AttributeRequest $request, Attribute $attribute)
    {
        $attribute->update($request->all());
        return new AttributeResource($attribute);
    }
74956
public function update($menu = null, $model, FormRequest $request)
    {
        $data = $request->all();
        $data['parent_id'] = $data['parent_id'] ?: null;
        $data['page_id'] = $data['page_id'] ?: null;
        $this->repository->update($data);

        return $this->redirect($request, $model);
    }
27975
public function update(Order $order, UpdateOrderRequest $request)
    {
        $this->order->update($order, $request->all());

        return redirect()->route('admin.order.order.show', $order->id)
            ->withSuccess(trans('core::core.messages.resource updated', ['name' => trans('order::orders.title.orders')]));
    }