Updates an existing AuthItem model.
If update is successful, the browser will be redirected to the 'view' page.
@param  string $id
@return mixed
773134
public function actionUpdate($id)
    {
        $request = \Yii::$app->request;
        if ($request->getIsOptions()) {
            return $this->ResponseOptions($this->verbs()['update']);
        }
        $model = $this->findModel($id);
        try{
            if ($model->load(Yii::$app->getRequest()->post()) && $model->save()) {
                return ['success'=>true,'message'=>'更新成功！'];
            }else{
                return ['success'=>false,'message'=>'更新失败，参数错误'];
            }
        }catch (Exception $e){
            throw new Exception($e);
        }

    }
980655
public function actionUpdate($id)
    {
        if (request()->post('_asnew') == '1') {
            $model = new Product();
        } else {
            $model = $this->findModel($id);
        }
        if ($model->loadAll(request()->post())) {
            if ($model->saveAll()) {
                set_flash_has_been_saved();
                create_all_term_relationships_of_all_term_type_of_product_type($model->product_type, $model->primaryKey);
                create_all_meta_of_all_product_type_meta($model->product_type, $model->primaryKey);
            } else {
                set_flash_has_not_been_saved();
            }
        }

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

    }
827364
public function update($id)
    {
        // Encorce permissions on updating ones own role
        if (!app('decoy.user')->can('update', 'admins') && Request::has('role')) {
            throw new AccessDeniedHttpException;
        }

        // If the password is empty, remove the key from the input so it isn't cleared
        if (!Request::has('password')) {
            Request::replace(array_except(Request::input(), ['password']));
        }

        // Continue processing
        return parent::update($id);
    }
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();
        }
    }
534066
public function actionView($id)
    {
        $model = $this->findModel($id);
        $model->updateCounters(['views' => 1]);
        return $this->render($model->view, [
            'model' => $model,
        ]);
    }
238986
public function update($id)
	{
		$messages = $this->posts->validForUpdate($id, Input::get('title'), Input::get('slug'));

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

		$post = $this->posts->update(
			$id,
			Input::get('title'),
			Input::get('content'),
			Input::get('slug'),
			explode(',', Input::get('tags')),
			(bool) Input::get('active'),
			(int) Input::get('user_id'),
			Carbon::createFromTimestamp(strtotime(Input::get('publish_date')))
		);

		return (string) $this->posts->find($id);
	}
212625
public function actionUpdate($id)
    {
        $model = User::findOne($id);
        $model->setScenario('update');
        $model->roles = $model->permissions = call_user_func(function() use($id){
            $permissions = yii::$app->getAuthManager()->getAssignments($id);
            foreach ($permissions as $k => &$v){
                $v = $k;
            }
            return $permissions;
        });
        if (Yii::$app->getRequest()->getIsPost()) {
            if ($model->load(Yii::$app->request->post()) && $model->save() && $model->assignPermission() ) {
                Yii::$app->getSession()->setFlash('success', yii::t('cms', 'Success'));
                return $this->redirect(['update', 'id' => $model->getPrimaryKey()]);
            } else {
                $errors = $model->getErrors();
                $err = '';
                foreach ($errors as $v) {
                    $err .= $v[0] . '<br>';
                }
                Yii::$app->getSession()->setFlash('error', $err);
            }
            $model = User::findOne(['id' => yii::$app->getUser()->getIdentity()->getId()]);
        }

        return $this->render('update', [
            'model' => $model,
        ]);
    }
1276488
protected function __apiUpdateStrict(string $id)
    {
        HCCities::where('id', $id)->update(request()->all());

        return $this->apiShow($id);
    }
1240833
public function actionUpdate($id) {
    Url::remember('', 'actions-redirect');
    $user = $this->findModel($id);
    $user->scenario = User::SCENARIO_UPDATE;
    $event = $this->getUserEvent($user);
    $this->performAjaxValidation($user);

    $this->trigger(self::EVENT_BEFORE_UPDATE, $event);
    if ($user->load(Yii::$app->request->post()) && $user->save()) {
      Yii::$app->getSession()->setFlash('success', Yii::t('users', 'Account details have been updated'));
      $this->trigger(self::EVENT_AFTER_UPDATE, $event);
      return $this->refresh();
    }

    return $this->render('_account', [
      'user' => $user,
    ]);
  }
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'));
    }
720196
public function actionUpdate($id)
    {
        if (!\Yii::$app->user->can('update'))
            return $this->alert(Module::t('core', 'Access denied.'));

        $model = $this->findModel($id);

        // $parent_node is empty, so it must be set
        if($one = $model->parents(1)->one())
        {
            $model->parent_node = $one->id;
            // new code
            $loaded = $model->load(\Yii::$app->request->post());
            
            // The General case
            if ($loaded && $model->save()) {
                return YII_DEBUG 
                    ? $this->redirect(['index'])
                    : $this->redirect(\Yii::$app->request->referrer);
            } else {
                return $this->renderAjax('update', [
                    'model' => $model,
                ]);
            }
        } else {
            \Yii::$app->session->setFlash(
                'warning',
                \Yii::t('core', 'Node has not parent.')
            );
            return $this->redirect(['index']);
        }
    }
1023142
public function actionDelete($id)
    {
        $this->findModel($id)->updateAttributes(['status' => User::STATUS_DELETED]);

        return $this->redirect(['index']);
    }
1339360
public function updateAction($id)
    {
        $form = $this->getForm();
        // Get request
        $request = $this->get('request');
        if ('POST' == $request->getMethod()) {
            $form->submit($request);
            
            if ($form->isValid()) {
                // Save instance
                $this->getManager()->create($form->getData());
                $this->get('session')->getFlashBag()->add('success', 'Instance Redis updated successfully');

                return new RedirectResponse($this->generateUrl('ringo_php_redmon'));
            }else {
                $this->get('session')->getFlashBag()->add('error', 'Some errors found');
            }
        }
        
        return $this->render(
            $this->getTemplatePath().'edit.html.twig',
            array(
                'form' => $form->createView(),
                'errors' => $form->getErrors()
            )
        );
    }
113291
public function update(Update $request, $id)
    {
        try {
            $data = !$request->has('password') ? $request->except('password') : $this->inputAll();

            $user = $this->repository->findById($id);

            $user->update($data);

            $user->roles()->sync((array) \Input::get('role'));

            return $this->redirect('users.index');
        } catch (ModelNotFoundException $e) {
            return $this->redirectNotFound();
        }
    }
694436
protected function __apiUpdate (string $id)
    {
        $record = HCResources::findOrFail ($id);

        $data = $this->getInputData ();

        $record->update (array_get ($data, 'record'));

        return $this->apiShow ($record->id);
    }
145868
public function getUpdate($id)
    {
        return $this->send($this->getHttp()->get($this->url.'updates/'.$id.'.json'));
    }
1323539
public function actionUpdate($id)
    {
        $model = $this->findModel($id);

        $this->beginTransaction();
        try {
            $this->fire('beforeUpdate', [$model]);
            $model->load(Yii::$app->request->post(), '');
            $this->fire('update', [$model]);
            if ($model->save()) {
                $this->fire('updated', [$model]);
                $this->commit();
                $model->refresh();
            } else {
                $this->fire('rollbackUpdate', [$model]);
                $this->rollBack();
            }
        } catch (\Exception $e) {
            $this->fire('errorUpdate', [$model, $e]);
            $this->rollBack();
            throw $e;
        }

        return $model;
    }