Updates an existing Content model.
If update is successful, the browser will be redirected to the 'view' page.
@param integer $id
@return mixed
348863
public function actionUpdate($id)
    {
        $model = $this->findModel($id);

        // check permissions
        if (!Yii::$app->user->can('roleContentModerator') // user is not moderator
         &&  Yii::$app->user->can('roleContentAuthor')    // but is author ...
         && !Yii::$app->user->can('updateOwnContent', [   // ... can edit only own article
                'content' => $model,                      //     - if article unvisible - always can
                'canEditVisible'                          //     - but if not visible - see this param
                    => $this->canAuthorEditOwnVisibleArticle,
            ])
        ) {
            if ($this->canAuthorEditOwnVisibleArticle) {
                throw new ForbiddenHttpException(Yii::t($this->tcModule, 'You can update only your own article'));
            } else {
                throw new ForbiddenHttpException(Yii::t($this->tcModule, 'You can update only your own article still unvisible'));
            }
        }

        $post = Yii::$app->request->post();
        $loaded = $model->load($post);

        $attributes = $model->attributes;
        if (!$this->canAuthorEditOwnVisibleArticle) unset($attributes['is_visible']);
        $attributeNames = array_keys($attributes);

        if ($loaded && $model->save(true, $attributeNames)) {
            if ($model->aftersave != $model::AFTERSAVE_LIST) {
                return $this->redirect(['view', 'id' => $model->id]);
            } else {
                $model->orderBy = $model::$defaultOrderBy;
                $model->page = $model->calcPage($model::find()->where(['parent_id' => $model->parent_id]));
                return $this->redirect(['index',
                    'parent' => $model->parent_id,
                    'page'   => $model->page,
                    'id'     => $model->id,
                    'sort'   => $model->orderByToSort(),
                ]);
            }
        } else {
            return $this->render('update', compact('model'));
        }
    }
1370484
public function update(Request $request, $id)
    {
        $response = $this->repository->update($id, $request->all());
        return Response::apiResponse([
            'data' => $response
        ]);

    }
861093
public function update(Update $request, $id)
    {
        try {
            $permission = $this->repository->findById($id);

            $data = $request->all();

            $permission->update($data);

            return $this->redirect('permissions.index');
        } catch (ModelNotFoundException $e) {
            return $this->redirectNotFound();
        }
    }
808208
public function actionUpdate($id)
    {
        $pid = Yii::$app->request->get('pid');
        $model = $this->findModel($id);
        $parent = $pid ? $this->findModel($pid) : $model;
        if ($model->load(\Yii::$app->request->post()) && $model->updateItem()) {
            Yii::$app->session->setFlash('success', Yii::t('modules/rbac', 'Saved'));
            return $this->redirect(['update', 'id' => $model->name, 'pid' => $parent->name]);
        }
        return $this->render('form', compact('model'));
    }
1141067
public function edit($id = null) {
        $cmsContentMeta = $this->CmsContentMeta->get($id, [
            'contain' => []
        ]);
        if ($this->request->is(['patch', 'post', 'put'])) {
            $cmsContentMeta = $this->CmsContentMeta->patchEntity($cmsContentMeta, $this->request->data);
            if ($this->CmsContentMeta->save($cmsContentMeta)) {
                $this->Flash->success('The cms content Meta has been saved.');
                return $this->redirect(['action' => 'index']);
            } else {
                $this->Flash->error('The cms content Meta could not be saved. Please, try again.');
            }
        }
        $cmsContent = $this->CmsContentMeta->CmsContent->find('list', ['limit' => 200]);
        $this->set(compact('cmsContentMeta', 'cmsContent'));
        $this->set('_serialize', ['cmsContentMeta']);
    }
203935
public function update(Update $request, $id)
    {
        try {
            $role = $this->repository->findById($id);

            $data = $request->all();

            $role->update($data);

            if ($role->permissions->count()) {
                $role->permissions()->detach($role->permissions->lists('id')->toArray());

                $role->permissions()->attach(\Input::get('permissions'));
            }

            if ($role->permissions->count() == 0 && count(\Input::get('permissions')) > 0) {
                $role->permissions()->attach(\Input::get('permissions'));
            }

            return $this->redirect('roles.index');
        } catch (ModelNotFoundException $e) {
            return $this->redirectNotFound();
        }
    }
553385
public function actionUpdate($id)
    {
        $model = $this->findModel($id);

        // if the model has an anonymousUsername value
        // we will consider it as an anonymous message
        if (!is_null($model->anonymousUsername))
        {
            $model->scenario = $model::SCENARIO_ANONYMOUS;
        }


        if ($model->load(Yii::$app->request->post()) && $model->save())
        {
            Yii::$app->session->setFlash('success', Yii::t('app', 'Comment has been saved.'));

            return $this->redirect(['index']);
        }

        return $this->render($this->updateView, [
            'model' => $model,
        ]);

    }
788954
public function putUpdate($id) {
    $validation = Validator::make(Input::all(), Term::$rules);

    if ($validation->fails()) {
      return Redirect::back()
        ->withInput()
        ->withErrors($validation)
        ->with('error', 'There were validation errors.');
    }

    $term = Term::find($id);
    $term->name = Input::get('name');
    $term->save();

    return Redirect::to(action('\Devfactory\Taxonomy\Controllers\TermsController@getIndex', ['id' => $term->vocabulary_id]))->with('success', 'Updated');
  }
1324424
public function actionFetch($id)
    {
        $model = $this->findModel($id);
        $model->setScenario('update');
        Yii::$app->response->format = Response::FORMAT_HTML;
        return $this->renderAjax('@vendor/frenzelgmbh/cm-address/views/widgets/views/_form_update', ['model' => $model]);
    }
1071943
protected function __apiUpdate(string $id)
    {
        $record = Galleries::findOrFail($id);

        $data = $this->getInputData();

        $record->update(array_get($data, 'record'));
        $record->updateTranslations(array_get($data, 'translations'));
        $record->images()->sync(array_get($data, 'images'));


        return $this->apiShow($record->id);
    }
392113
public function edit($id)
    {
        try {
            $user = $this->repository->findById($id);

            $role = $user->roles->lists('id');

            return $this->view('users.edit', compact('user', 'role'));
        } catch (ModelNotFoundException $e) {
            return $this->redirectNotFound();
        }
    }
1114198
public function actionUpdate($id)
    {
        $model = $this->findModel($id);
        $model->loadDefaultValues();
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            if(Yii::$app->request->post('action') === 'apply') {
                return $this->redirect(['update', 'id' => $model->id]);
            }else{
                return $this->redirect(['view', 'id' => $model->id]);
            }
        }

        return $this->render('update', [
            'model' => $model,
        ]);
    }
90464
public function update($id)
    {
        $model = ApiUsers::query()->findOrFail($id);
        $form  = $this->getForm($model);
        $url   = url()->previous();
        if (!$form->isValid()) {
            return $this->redirectWithErrors($url, $form->getMessageBag());
        }
        $model->enabled = input('api', 'off') === 'on';
        if (!is_null($whitelist      = input('whitelist'))) {
            $model->whitelist = $whitelist;
        }
        if (!$model->save()) {
            return $this->redirectWithMessage($url, trans('antares/api::response.user_config_not_saved'), 'error');
        }
        return $this->redirectWithMessage($url, trans('antares/api::response.user_config_saved'));
    }
1210014
public function actionUpdate($id)
    {
        $model = $this->findModel($id);
        if ($model->load(Yii::$app->request->post())) {
            if (Request::isAjax()) {
                Yii::$app->getResponse()->format = Response::FORMAT_JSON;
                return ActiveForm::validate($model);
            } elseif ($model->save()) {
                return $this->flash('更新成功', 'success');
            }
        }
        return $this->render('update', [
            'model' => $model,
        ]);
    }
1139316
public function actionUpdate($id)
	{
		$model=$this->loadModel($id);

		// Uncomment the following line if AJAX validation is needed
		// $this->performAjaxValidation($model);

		if(isset($_POST['BaseCccfCustomField']))
		{
			$model->attributes=$_POST['BaseCccfCustomField'];
			if($model->save())
				$this->redirect(array('view','id'=>$model->id));
		}

		$this->render('update',array(
			'model'=>$model,
		));
	}
117790
public function updateAction($id)
    {
        $this->initializeScaffolding();
        $this->checkRequest();

        try {
            $this->beforeRead();
            $this->view->record = $this->scaffolding->doRead($id);
            $this->afterRead();

            $this->beforeUpdate();
            $this->scaffolding->doUpdate($id, $this->request->getPost());
            $this->flash->success($this->successMessage);
            return $this->afterUpdate();
        } catch (Exception $e) {
            $this->flash->error($e->getMessage());
            $this->afterUpdateException();
        }

        return $this->dispatcher->forward(['action' => 'edit']);
    }
1161226
public function update($id)
	{
		$messages = $this->users->validForUpdate(
			$id,
			Input::get('first_name'),
			Input::get('last_name'),
			Input::get('email'),
			Input::get('password')
		);

		if (count($messages) > 0)
		{
			return Response::json($messages->all(), 400);
		}

		return $this->users->update(
			$id,
			Input::get('first_name'),
			Input::get('last_name'),
			Input::get('email'),
			(bool) Input::get('active'),
			Input::get('password')
		);
	}