Update settings for the settings object.

@param  WP_REST_Request $request Full detail about the request.
@return WP_Error|array
326806
public function update_item( $request ) {
		$options = $this->get_registered_options();
		$params = $request->get_params();

		foreach ( $options as $name => $args ) {
			if ( ! array_key_exists( $name, $params ) ) {
				continue;
			}

			/**
			 * Filters whether to preempt a setting value update.
			 *
			 * Allow hijacking the setting update logic and overriding the built-in behavior by
			 * returning true.
			 *
			 * @since 4.7.0
			 *
			 * @param boolean $result Whether to override the default behavior for updating the
			 *                        value of a setting.
			 * @param string  $name   Setting name (as shown in REST API responses).
			 * @param mixed   $value  Updated setting value.
			 * @param array   $args   Arguments passed to `register_setting()` for this setting.
			 */
			$updated = apply_filters( 'rest_pre_update_setting', false, $name, $request[ $name ], $args );
			if ( $updated ) {
				continue;
			}

			// A null value means reset the option, which is essentially deleting it
			// from the database and then relying on the default value.
			if ( is_null( $request[ $name ] ) ) {
				delete_option( $args['option_name'] );
			} else {
				update_option( $args['option_name'], $request[ $name ] );
			}
		}

		return $this->get_item( $request );
	}
1085558
public function update_item_permissions_check( $request ) {

		$id = (int) $request['id'];

		$comment = get_comment( $id );

		if ( $comment && ! $this->check_edit_permission( $comment ) ) {
			return new WP_Error( 'rest_cannot_edit', __( 'Sorry, you can not edit this comment.' ), array( 'status' => rest_authorization_required_code() ) );
		}

		return true;
	}
1022393
protected function update_additional_fields_for_object( $object, $request ) {
		$additional_fields = $this->get_additional_fields();

		foreach ( $additional_fields as $field_name => $field_options ) {
			if ( ! $field_options['update_callback'] ) {
				continue;
			}

			// Don't run the update callbacks if the data wasn't passed in the request.
			if ( ! isset( $request[ $field_name ] ) ) {
				continue;
			}

			$result = call_user_func( $field_options['update_callback'], $request[ $field_name ], $object, $field_name, $request, $this->get_object_type() );
			if ( is_wp_error( $result ) ) {
				return $result;
			}
		}

		return true;
	}
201558
public function setRequest(Request $request)
    {
        $context = (new RequestContext())->fromRequest($request);

        $this->cachedRoot = null;
        $this->cachedSchema = null;
        return $this->setContext($context);
    }
141334
public function update(Request $request)
    {
        $this->authorize('update', Settings::class);

        $this->validate($request, [
            'appname'     => 'required',
            'description' => 'required',
            'keywords'    => 'required',
            'author'      => 'required',
        ]);

        Settings::first()->update([
            'appname'       => $request->appname,
            'description'   => $request->description,
            'keywords'      => $request->keywords,
            'author'        => $request->author,
        ]);

        return redirect()->route('laralum::settings.index', ['p' => 'Settings'])->with('success', __('laralum_settings::general.updated_settings'));
    }
190753
public function changeType(Request $request)
    {
        $typeLst = $request->request->get('types', []);
        $records = RecordsRequest::fromRequest($this->app, $request, false, [\ACL::CANMODIFRECORD]);
        $mimeLst = $request->request->get('mimes', []);
        $forceType = $request->request->get('force_types', '');
        $updated = [];

        foreach ($records as $record) {
            try {
                $recordType = !empty($forceType) ? $forceType : (isset($typeLst[$record->getId()]) ? $typeLst[$record->getId()] : null);
                $mimeType = isset($mimeLst[$record->getId()]) ? $mimeLst[$record->getId()] : null;

                if ($recordType) {
                    $record->setType($recordType);
                    $updated[$record->getId()]['record_type'] = $recordType;
                }

                if ($mimeType) {
                    $record->setMimeType($mimeType);
                    $updated[$record->getId()]['mime_type'] = $mimeType;
                }
            } catch (\Exception $e) {

            }
        }

        return $this->app->json(['success' => true, 'updated' => $updated], 201);
    }
992515
public function update($id,Request $request)
    {
        $user_setting = User_setting::findOrfail($id);
    	
        $user_setting->user_id = $request->user_id;
        
        $user_setting->setting_id = $request->setting_id;
        
        $user_setting->notes = $request->notes;
        
        
        $user_setting->save();

        return redirect('user_setting');
    }
430596
public function update(Request $request)
    {
        $permission = Permission::findOrFail($request->permission_id);

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

        $permission->update();

        return redirect('scaffold-permissions');
    }
551386
public function update(AccountSettingsRequest $request)
    {
        $data = $request->validated();
        $currentUser = $request->user($this->getGuard());

        ! $request->hasFile('profile_picture')
        || $currentUser->addMediaFromRequest('profile_picture')
                       ->sanitizingFileName(function ($fileName) {
                           return md5($fileName).'.'.pathinfo($fileName, PATHINFO_EXTENSION);
                       })
                       ->toMediaCollection('profile_picture', config('cortex.auth.media.disk'));

        ! $request->hasFile('cover_photo')
        || $currentUser->addMediaFromRequest('cover_photo')
                       ->sanitizingFileName(function ($fileName) {
                           return md5($fileName).'.'.pathinfo($fileName, PATHINFO_EXTENSION);
                       })
                       ->toMediaCollection('cover_photo', config('cortex.auth.media.disk'));

        // Update profile
        $currentUser->fill($data)->save();

        return intend([
            'back' => true,
            'with' => ['success' => trans('cortex/auth::messages.account.updated_account')]
                      + (isset($data['two_factor']) ? ['warning' => trans('cortex/auth::messages.verification.twofactor.phone.auto_disabled')] : []),
        ]);
    }
1287849
public function store(SettingRequest $request)
    {
        $this->setting->setFromRequest($request->request->all());

        flash(trans('core::messages.resource.resource saved', ['name' => trans('setting::setting.title.settings')]));

        return redirect()->back();
    }
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,
        ]);
    }
1064438
public function get_items( $request ) {

		$parent = $this->get_post( $request['parent'] );
		if ( ! $request['parent'] || ! $parent || $this->parent_post_type !== $parent->post_type ) {
			return new WP_Error( 'rest_post_invalid_parent', __( 'Invalid post parent id.' ), array( 'status' => 404 ) );
		}

		$revisions = wp_get_post_revisions( $request['parent'] );

		$response = array();
		foreach ( $revisions as $revision ) {
			$data = $this->prepare_item_for_response( $revision, $request );
			$response[] = $this->prepare_response_for_collection( $data );
		}
		return rest_ensure_response( $response );
	}
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;
    }
374212
public function get_update_datas(Request $request)
    {
        $datas = [
            'title'       => $request->get('modif_title'),
            'description' => $request->get('modif_description'),
            'category'    => $request->get('modif_category'),
            'tags'        => $request->get('modif_tags'),
            'privacy'     => $request->get('modif_privacy'),
        ];

        return $datas;
    }
940869
public function store(Request $request)
    {
        $setting = new Setting();

        
        $setting->name = $request->name;

        
        $setting->description = $request->description;

        
        
        $setting->save();

        return redirect('setting');
    }
825311
public function update(Request $request)
    {
        $this->authorize('update', Settings::class);

        $this->validate($request, [
            'text_editor' => 'required|in:plain-text,markdown,wysiwyg',
            'public_url'  => 'required|max:255',
        ]);

        Settings::first()->update([
            'text_editor' => $request->input('text_editor'),
            'public_url'  => $request->input('public_url'),
        ]);

        return redirect()->route('laralum::settings.index', ['p' => 'Tickets'])
            ->with('success', __('laralum_tickets::general.tickets_settings_updated'));
    }
973546
public function updateAction(Request $request, $id)
    {
        $class_name = $this->container->getParameter('acs_settings.setting_class');
        $settingmanager = $this->get('acs.setting_manager');
        $user_fields = $settingmanager->loadUserFields();
        $em = $this->getDoctrine()->getManager();

        $entity = $this->get('security.context')->getToken()->getUser();

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

        $editForm = $this->createForm(new ConfigSettingCollectionType($user_fields,$em), $entity);

        $editForm->bind($request);


        $postData = $request->request->get('acs_settings_usersettings');

        if ($editForm->isValid()) {
            if (isset($postData['settings'])) {
                    $settings = $postData['settings'];

                    foreach ($settings as $setting) {
                        $args = array(
                            'user' => $entity->getId(),
                            'setting_key' => $setting['setting_key'],
                        );

                        if(isset($setting['service_id'])){
                            $service = $em->getRepository('ACSACSPanelBundle:Service')->find($setting['service_id']);
                            $args['service'] = $service;
                        }

                        $panelsetting = $em->getRepository('ACSACSPanelBundle:PanelSetting')->findOneBy($args);

                        if ($panelsetting && isset($setting['value'])) {
                            $panelsetting->setValue($setting['value']);
                            $em->persist($panelsetting);
                            $em->flush();
                        }
                    }
                    $em->flush();
            }
            return $this->redirect($this->generateUrl('settings'));
        }

        return $this->render('ACSACSPanelSettingsBundle:ConfigSetting:new.html.twig', array(
            'entity' => $entity,
            'form'   => $editForm->createView(),
        ));
    }