Update the specified resource in storage.

@param \Illuminate\Http\Request $request

@return \Illuminate\Http\Response
430596
public function update(Request $request)
    {
        $permission = Permission::findOrFail($request->permission_id);

        $permission->name = $request->name;

        $permission->update();

        return redirect('scaffold-permissions');
    }
346632
public function setRequest(Request $request)
    {
        $this->setParam('request', $request);
        $this->request = $request;
        return $this;
    }
504346
public function update(Request $request, $id)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate([
            'description' => 'max:256',
            'name' => 'required|max:32',
        ]);
        $memberTag = MemberTag::findOrFail($id);
        $this->authorize('update', $memberTag);
        if ($request->has('description')) {
            $memberTag->description = $request->description;
        }
        $memberTag->name = $request->name;
        $memberTag->save();
        return fractal($memberTag, new MemberTagTransformer())
            ->withResourceName('memberTag')
            ->respond();

    }
659244
public function indexAction(Request $request)
    {

        /** @var \Networking\InitCmsBundle\Lib\PhpCacheInterface $phpCache */
        $phpCache = $this->get('networking_init_cms.lib.php_cache');

        /** @var PageSnapshotInterface $page */
        $page = $request->get('_content');

        $template = $request->get('_template');
        if ($template instanceof \Sensio\Bundle\FrameworkExtraBundle\Configuration\Template) {
            $template = $template->getTemplate();
        }
        $user = $this->getUser();

        if ($phpCache->isCacheable($request, $user) && $page instanceof PageSnapshotInterface) {
            if (!$this->isSnapshotActive($page)) {
                throw new NotFoundHttpException();
            }

            if ($this->getSnapshotVisibility($page) != PageInterface::VISIBILITY_PUBLIC) {
                if (false === $this->get('security.authorization_checker')->isGranted('ROLE_USER')) {
                    throw new AccessDeniedException();
                }
            }

            $updatedAt = $phpCache->get(sprintf('page_%s_created_at', $page->getId()));
            $cacheKey = $request->getLocale().$request->getPathInfo();

            if ($updatedAt != $page->getSnapshotDate()) {
                $phpCache->delete($cacheKey);
            }

            $response = $phpCache->get($request->getLocale().$request->getPathInfo());

            if (!$response || !$response instanceof Response) {
                $params = $this->getPageParameters($request);

                if ($params instanceof RedirectResponse) {
                    return $params;
                }
                $html = $this->renderView(
                    $template,
                    $params
                );
                $response = new Response($html);

                $phpCache->set($cacheKey, $response);
                $phpCache->set(sprintf('page_%s_created_at', $page->getId()), $page->getSnapshotDate());
            } else {
                $phpCache->touch($cacheKey);
                $phpCache->touch(sprintf('page_%s_created_at', $page->getId()));
            }
        } else {
            $params = $this->getPageParameters($request);

            if ($params instanceof RedirectResponse) {
                return $params;
            }
            $html = $this->renderView(
                $template,
                $params
            );
            $response = new Response($html);
        }

        if ($this->getPageHelper()->isAllowLocaleCookie() && !$this->getPageHelper()->isSingleLanguage()) {
            $response->headers->setCookie(new Cookie('_locale', $request->getLocale()));
        }

        return $response;
    }
126291
public function update(Request $request, $id)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate([
            "countryCode" => 'required|regex:/\d{1,2}/',
            "label" => "required|max:50",
            "phoneNumber" => 'required|regex:/\d{10}/',
        ]);
        $phone = Phone::findOrFail($id);
        $this->authorize('manage', $phone);
        $phone->country_code = $request->countryCode;
        $phone->label = $request->label;
        $phone->phone_number = $request->phoneNumber;
        $this->authorize('manage', $phone);
        $phone->save();
        return fractal($phone, new PhoneTransformer())
            ->withResourceName('phone')
            ->respond();

    }
138566
public function updateTreeAction(Request $request)
    {
        /** @var Request $request */
        $nodes = $request->get('nodes') ? $request->get('nodes') : [];

        $admin = $this->get('networking_init_cms.admin.tag');

        $validator = $this->get('validator');
        try {
            foreach ($nodes as $node) {
                if (!$node['id']) {
                    continue;
                }
                /** @var $tag Tag */
                $tag = $admin->getObject($node['id']);
                if ($node['parent_id']) {
                    $parent = $admin->getObject($node['parent_id']);
                    $tag->setParent($parent);
                } else {
                    $tag->setParent(null);
                }

                $tag->setLevel($node['depth'] + 1);

                $errors = $validator->validate($tag);
                if (count($errors) > 0) {
                    throw new ValidatorException();
                }

                $this->admin->update($tag);
            }

            $response = ['status' => 'success', 'message' => $this->admin->trans('info.tag_sorted')];
        } catch (\Exception $e) {
            $response = ['status' => 'error', 'message' => $this->admin->trans('info.tag_sorted_error')];
        }

        return $this->renderJson($response);
    }
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(),
        ]);
    }
369259
public function updateUser($userId, Request $request)
    {
        $user = $this->userService->loadUser($userId);

        $updateStruct = $this->inputDispatcher->parse(
            new Message(
                array(
                    'Content-Type' => $request->headers->get('Content-Type'),
                    // @todo Needs refactoring! Temporary solution so parser has access to URL
                    'Url' => $request->getPathInfo(),
                ),
                $request->getContent()
            )
        );

        if ($updateStruct->sectionId !== null) {
            $section = $this->sectionService->loadSection($updateStruct->sectionId);
            $this->sectionService->assignSection(
                $user->getVersionInfo()->getContentInfo(),
                $section
            );
        }

        $updatedUser = $this->userService->updateUser($user, $updateStruct->userUpdateStruct);
        $updatedContentInfo = $updatedUser->getVersionInfo()->getContentInfo();
        $mainLocation = $this->locationService->loadLocation($updatedContentInfo->mainLocationId);
        $contentType = $this->contentTypeService->loadContentType($updatedContentInfo->contentTypeId);

        return new Values\RestUser(
            $updatedUser,
            $contentType,
            $updatedContentInfo,
            $mainLocation,
            $this->contentService->loadRelations($updatedUser->getVersionInfo())
        );
    }
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!');
    }
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()
        );
    }
142230
public function update($request) {
        $this->resolveModel();
        $model = Dir::apiModel($this->model);
        $modelFind = $model::find($request->id);

        if(!empty($request->relationalModel)) {
            $idRelationalModel = trim(strtolower($request->relationalModel), 's');
            $idRelationalModel =  $idRelationalModel.'Id';
            if($modelFind->$idRelationalModel != $request->idRelational) killer('400');
        }

        foreach($modelFind->getTuples() as $tuple)
            if(!empty($request->$tuple))
                $modelFind->$tuple = $request->$tuple;

        $modelFind->update();
        return $modelFind;
    }
75080
public function update(UpdateRequest $request)
    {
        $this->addDefaultGeoFields(\Request::input('template'));
        $this->useTemplate(\Request::input('template'));

        return parent::updateCrud();
    }
1370484
public function update(Request $request, $id)
    {
        $response = $this->repository->update($id, $request->all());
        return Response::apiResponse([
            'data' => $response
        ]);

    }
1331165
public function update(Request $request)
    {
        $role = Role::findOrFail($request->role_id);

        $role->name = $request->name;

        $role->update();

        return redirect('scaffold-roles');
    }
133610
public function update(Request $request)
    {
        $data = array_get($request->input(), '2fa', []);
        return $this->processor->update($this, $data);
    }
171847
public function updateAction(Request $request)
        {

            /** @var License $oLicense */
            $oLicense = LicenseQuery::create()->findOne();

            if ($oLicense === null) {
                throw $this->createNotFoundException('Unable to find License entity.');
            }

            $editForm = $this->createEditForm($oLicense);
            $editForm->handleRequest($request);

            $aResult = array(
                "success" => false,
                "message" => ""
            );

            $sLico = SystemSettings::get("lico");

            $aHeaders = array(
                'Content-Type: application/json'
            );

            $sDomain = $this->_getSiteURL();

            $aRequest = array(
                'lico' => array(
                    'domain'  => $sDomain,
                    'license' => $oLicense->getSerial()
                ),
            );

            $sRequest = json_encode($aRequest);

            /*
             * Check license against license-server
             */
            $oRequest = curl_init($sLico . "/api/check/license");
            curl_setopt($oRequest, CURLOPT_HTTPHEADER, $aHeaders);
            curl_setopt($oRequest, CURLOPT_TIMEOUT, 120);
            curl_setopt($oRequest, CURLOPT_POST, 1);
            curl_setopt($oRequest, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($oRequest, CURLOPT_SSL_VERIFYHOST, false);
            curl_setopt($oRequest, CURLOPT_POSTFIELDS, $sRequest);
            curl_setopt($oRequest, CURLOPT_RETURNTRANSFER, true);
            $response    = curl_exec($oRequest);
            $iHttpStatus = curl_getinfo($oRequest, CURLINFO_HTTP_CODE);
            $error       = curl_error($oRequest);
            curl_close($oRequest);

            if ($iHttpStatus == 200) {

                $oResponse = json_decode($response);

                if ($editForm->isValid() && $oResponse->valid == true) {
                    $aResult['max_clients'] = $oResponse->max_clients;
                    $aResult['valid_until'] = $oResponse->valid_until;
                    $aResult['domain']      = $sDomain;

                    $aResult['success'] = true;
                    $aResult['message'] = $this->get("translator")->trans("license.update.successful");

                    // license valid, save new license-data
                    $oLicense->setValidUntil($aResult['valid_until']);
                    $oLicense->setMaxClients($aResult['max_clients']);
                    $oLicense->setDomain($sDomain);
                    $oLicense->save();
                } else {
                    $aResult['success'] = false;
                    $aResult['message'] = $this->get("translator")->trans("license.update.failed");
                    $aResult['valid_until'] = strtotime("1970-01-01");
                    $aResult['max_clients'] = 0;
                    $aResult['domain'] = "-";
                }


            } else {

                $aResult['max_clients'] = $oLicense->getMaxClients();
                $aResult['valid_until'] = strtotime($oLicense->getValidUntil());
                $aResult['domain']      = $sDomain;

                $aResult['success'] = false;
                $aResult['message'] = $this->get("translator")->trans("license.update.failed_lico");
            }


            $sResult  = json_encode($aResult);
            $response = new Response($sResult);
            $response->headers->set('Content-Type', 'application/json');

            return $response;
        }
254871
public function refresh(Request $request)
    {
        return (new Response('Refreshed.'))->withCookie($this->cookieFactory->make(
            $request->user()->getKey(), $request->session()->token()
        ));
    }