Update a package(s).

@param Request $request

@throws PackageManagerException

@return \Symfony\Component\HttpFoundation\JsonResponse
186362
public function update(Request $request)
    {
        $package = $request->query->get('package');

        try {
            $response = $this->app['extend.manager']->updatePackage((array) $package);
        } catch (\Exception $e) {
            return $this->getJsonException($e);
        }

        if ($response === 0) {
            $this->app['logger.system']->info("Updated $package", ['event' => 'extensions']);

            return $this->json($this->manager()->getOutput());
        }

        return $this->getJsonException(new PackageManagerException($this->manager()->getOutput(), $response));
    }
41895
public function install(Request $request)
    {
        $package = $request->get('package');
        $version = $request->get('version');
        try {
            $response = $this->manager()->requirePackage(
                [
                    'name'    => $package,
                    'version' => $version,
                ]
            );
        } catch (\Exception $e) {
            return $this->getJsonException($e);
        }

        if ($response === 0) {
            $this->app['extensions.stats']->recordInstall($package, $version);
            $this->app['logger.system']->info("Installed $package $version", ['event' => 'extensions']);

            return new Response($this->manager()->getOutput());
        }

        return $this->getJsonException(new PackageManagerException($this->manager()->getOutput(), $response));
    }
1075118
public function updateLegacyURI(Request $request)
    {
        $viewParametersString = rtrim(
            $request->attributes->get(
                'semanticPathinfo',
                $request->getPathinfo()
            ) . $request->attributes->get('viewParametersString'),
            '/'
        );

        $uri = eZURI::instance();
        $uri->setURIString($viewParametersString);
    }
1200178
public function updateManyToManyAction(Request $request)
    {
        /** @var AbstractAdmin $admin */
        $admin = $this->getAdmin();

        $admin->checkAccess('edit');

        $em = $admin->getDoctrine()->getManager();

        $ids = $request->request->get('value');
        $id = $request->request->get('pk');

        $field = $request->request->get('field');

        $object = $admin->getObject($id);

        /** @var \Sonata\DoctrineORMAdminBundle\Model\ModelManager $mm */
        $mm = $admin->getModelManager();

        $ClassMetadata = $mm->getMetadata($admin->getClass());

        $associationMapping = $ClassMetadata->getAssociationMapping($field);

        $items = $em->getRepository($associationMapping['targetEntity'])->findBy([
            'id' => $ids,
        ]);

        \call_user_func([$object, 'set' . ucfirst($field)], $items);

        $admin->update($object);

        $result = [
        ];

        $associationAdmin = $admin->getAdminByClass($associationMapping['targetEntity']);

        foreach ($items as $item) {
            if (method_exists($item, 'getId') && method_exists($item, 'getName')) {
                $result[] = [
                    'id' => $item->getId(),
                    'label' => $item->getName(),
                    'edit_url' => $associationAdmin->generateObjectUrl('edit', $item),
                ];
            }
        }

        return new JsonResponse([
            'items' => $result,
        ]);
    }
302467
public function update(Tag $model, UpdateRequest $request)
    {
        $model->update( $request->all() );

        \Cache::tags('response')->flush();

        return $this->successJsonResponse();
    }
133610
public function update(Request $request)
    {
        $data = array_get($request->input(), '2fa', []);
        return $this->processor->update($this, $data);
    }
410229
public function updateOrder(Request $request): JsonResponse
    {
        Category::rebuildTree(
            $request->input('tree')
        );

        $this->clearCache();

        $movedNode = Category::findOrFail(
            $request->input('moved')
        );

        dispatch(
            new RegenerateCategoryFullSlugs($movedNode)
        );

        return response()->json([
            'state' => 'success',
        ]);
    }
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')]));
    }
1349079
public function store(Request $request)
    {
        $package = new Package();

        
        $package->name = $request->name;

        
        $package->description = $request->description;

        
        $package->string_composer = $request->string_composer;
        $package->description_does_what = $request->description_does_what;
        $package->dashboard_URL = $request->dashboard_URL;
        $package->github_URL = $request->github_URL;

        
        
        $package->save();

        return redirect('package');
    }
894140
public function updateAction(Request $request)
    {
        $schemaAlias = $request->attributes->get('schema');

        $this->isGrantedOr403($schemaAlias);

        $settingsManager = $this->getSettingsManager();
        $settings = $settingsManager->load($schemaAlias);

        $isApiRequest = $this->isApiRequest($request);

        $form = $this
            ->getSettingsFormFactory()
            ->create($schemaAlias, $settings, $isApiRequest ? ['csrf_protection' => false] : [])
        ;

        if ($form->handleRequest($request)->isValid()) {
            $messageType = 'success';
            try {
                $settingsManager->save($settings);
                $message = $this->getTranslator()->trans('sylius.settings.update', [], 'flashes');
            } catch (ValidatorException $exception) {
                $message = $this->getTranslator()->trans($exception->getMessage(), [], 'validators');
                $messageType = 'error';
            }

            if ($isApiRequest) {
                return $this->handleView($this->view(null, Response::HTTP_NO_CONTENT));
            }

            $request->getSession()->getBag('flashes')->add($messageType, $message);

            if ($request->headers->has('referer')) {
                return $this->redirect($request->headers->get('referer'));
            }
        }

        return $this->render($request->attributes->get('template', 'SyliusSettingsBundle:Settings:update.html.twig'), [
            'settings' => $settings,
            'form' => $form->createView(),
        ]);
    }
598897
public function update(Request $request, $id)
    {
        return (strtoupper($request->getMethod()) === 'PUT') ? $this->putAction($request,
            $id) : $this->patchAction($request, $id);
    }
1259835
public function updateAction(Item $question, Request $request)
    {
        $errors = [];

        $data = $this->decodeRequestData($request);
        if (empty($data)) {
            // Invalid or empty JSON data received
            $errors[] = [
                'path' => '',
                'message' => 'Invalid JSON data',
            ];
        } else {
            // Try to update question with data
            try {
                $question = $this->manager->update($question, $data);
            } catch (InvalidDataException $e) {
                $errors = $e->getErrors();
            }
        }

        if (empty($errors)) {
            // Item updated
            return new JsonResponse(
                $this->manager->serialize($question, [Transfer::INCLUDE_SOLUTIONS, Transfer::INCLUDE_ADMIN_META])
            );
        } else {
            // Invalid data received
            return new JsonResponse($errors, 422);
        }
    }
1232222
public function update(Request $request)
    {
        $user = $request->user();

        $this->validate($request, [
            'name' => 'required',
            'email' => 'required|email|unique:users,email,'.$user->id,
        ]);

        return tap($user)->update($request->only('name', 'email'));
    }
1070131
public function update(Request $request)
    {
        Voyager::canOrFail('browse_database');

        $table = json_decode($request->table, true);

        try {
            DatabaseUpdater::update($table);
            // TODO: synch BREAD with Table
            // $this->cleanOldAndCreateNew($request->original_name, $request->name);
        } catch (Exception $e) {
            return back()->with($this->alertException($e))->withInput();
        }

        return redirect()
               ->route('voyager.database.edit', $table['name'])
               ->with($this->alertSuccess("Successfully updated {$table['name']} table"));
    }
1179499
public function updateAction(Request $request, $id)
    {
        $response = ['error' => false];

        try {
            $this->get('ongr_translations.translation_manager')->edit($id, $request);
        } catch (\LogicException $e) {
            $response = ['error' => true];
        }

        return new JsonResponse($response);
    }
107180
public function update(Storage $storage, UpdateStorageRequest $request)
    {
        $this->storage->update($storage, $request->all());

        return redirect()->route('admin.product.storage.index')
            ->withSuccess(trans('core::core.messages.resource updated', ['name' => trans('product::storages.title.storages')]));
    }
1128056
public function update(Request $request)
    {
        $output = $this->schemaManager()->update();
        $this->session()->set('dbupdate_result', $output->getResponseStrings());

        return $this->redirectToRoute('dbupdate_result');
    }