Updates an existing Measure model.
If update is successful, the browser will be redirected to the 'view' page.
@param integer $id
@return mixed
185916
public function run($id = null)
    {
        if ($id === null) {
            $model = new Measure;
            $model->loadDefaultValues();
        } else {
            $model = $this->controller->findModel($id);
        }
        $isLoaded = $model->load(\Yii::$app->request->post());
        $hasAccess = ($model->isNewRecord && \Yii::$app->user->can('measure-create-measure'))
            || (!$model->isNewRecord && \Yii::$app->user->can('measure-edit-measure'));
        if ($isLoaded && !$hasAccess) {
            throw new ForbiddenHttpException;
        }
        if ($isLoaded && $model->save()) {
            return $this->controller->redirect(['update', 'id' => $model->id]);
        } else {
            return $this->controller->render(
                'update',
                [
                    'hasAccess' => $hasAccess,
                    'model' => $model,
                ]
            );
        }
    }
932746
public function update(Request $request, $id)
    {
        try {
            $this->permissionRepositoryInterface->update($request->all(), $id);
        } catch (FormValidationException $e) {
            Flash::error($e->getMessage());

            return redirect()
              ->route('permissions.edit', ['id' => $id])
              ->withErrors($e->getErrors())
              ->withInput();
        } catch (PermissionsException $e) {
            Flash::error($e->getMessage());

            return redirect()->route('permissions.index');
        }

        Flash::success(trans('dashboard::dashboard.flash.permission.edit.success'));

        return redirect()->route('permissions.edit', ['id' => $id]);
    }
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();
        }
    }
621333
public function actionUpdate($id)
    {
        $this->layout = static::MAIN_LAYOUT;
        $model = $this->findModel($id);

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            $this->afterUpdate($model);
            return $this->redirect(['view', 'id' => $model->id]);
        } else {
            if($model->template) {
                return $this->render($model->template, [
                    'model' => $model,
                ]);
            } else {
                return $this->render('update', [
                    'model' => $model,
                ]);
            }
        }
    }
624682
protected function __apiUpdate(string $id)
    {
        $record = HCPages::findOrFail($id);

        $data = $this->getInputData();

        $record->update(array_get($data, 'record'));
        $record->updateTranslations(array_get($data, 'translations'));
        $record->categories()->sync(array_get($data, 'categories', []));
        $record->removeCachedMenu();

        return $this->apiShow($record->id);
    }
393473
public function actionUpdate($id)
    {
        if (request()->post('_asnew') == '1') {
            $model = new User();
        }else{
            $model = $this->findModel($id);
        }

        if (!is_role('admin')) {
            throw new \yii\web\HttpException(403, t('app', 'You are not allowed to perform this action.'));
        }

        if ($model->loadAll(request()->post())) {
            if ($model->saveAll()) {
                set_flash_has_been_saved();
                return $this->redirect(['update', 'id' => $model->id]);
            } else {
                set_flash_has_not_been_saved();
            }
        }

        return $this->render('update', [
            'model' => $model,
        ]);
    }
762614
public function update($id)
    {
        try
        {
            $credentials = Input::except('groups');
            $credentials['groups'] = Input::get('groups', array());
            $credentials['id'] = $id;


            if( $this->userForm->update($credentials) )
            {
                return Redirect::route('cpanel.users.index')
                    ->with('success', Lang::get('cpanel::users.update_success'));
            }

            return Redirect::back()
                ->withInput()
                ->withErrors($this->userForm->getErrors());
        }
        catch ( UserNotFoundException $e)
        {
            return Redirect::route('cpanel.users.index')
                    ->with('error', $e->getMessage());
        }
    }
1301325
protected function __apiUpdate (string $id)
    {
        $record = HCPagesCategories::findOrFail($id);

        $data = $this->getInputData();

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

        return $this->apiShow($record->id);
    }
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()
            )
        );
    }
691741
public function actionUpdate($id)
    {
        $request = \Yii::$app->request;
        if ($request->getIsOptions()) {
            return $this->ResponseOptions($this->verbs()['update']);
        }
        try{
            $model = $this->findModel($id);
            if ($model->menuParent) {
                $model->parent_name = $model->menuParent->name;
            }
            if ($model->load(Yii::$app->request->post()) && $model->save()) {
                Helper::invalidate();
                return ["success"=> true];
            } else {
                return ["success"=> false];
            }
        }catch(Exception $e){
            throw new Exception($e);
        }
    }
1067870
public function update($id)
    {
        $user = $this->userRepo->getById($id);
        if (!empty($user)) {
            $this->authorize('update', $user);
            $input = $this->validator->bind('nick', ['user_id' => $user->id])->bind('email', ['user_id' => $user->id])
                ->validate('update');
            $user  = $this->userRepo->update($user, $input);
            return $this->respondWithSuccess($user, new UserTransformer());
        }
        return $this->respondNotFound();
    }
222225
protected function __apiUpdate(string $id)
    {
        $record = HCCountries::findOrFail($id);
        $record->languages()->sync(array_get($this->getInputData(), 'languages'));

        return $this->apiShow($record->id);
    }
1181464
public function update(Request $request, $id)
    {
        $entry = $this->entriesRepository->getById($id, $this->resource);
        $this->validate($request, $this->validationRules($this->resource, $entry));

        $this->entriesRepository->update($id, $request, $this->resource);

        return redirect()->back()->with('success', 'Updated');
    }
1023142
public function actionDelete($id)
    {
        $this->findModel($id)->updateAttributes(['status' => User::STATUS_DELETED]);

        return $this->redirect(['index']);
    }
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);
    }
1307234
public function update(Update $request, $id)
    {
        try {
            $article = $this->repository->findById($id);

            $data = $request->all();

            unset($data['image']);
            unset($data['type']);

            if (\Input::hasFile('image')) {
                $article->deleteImage();

                $this->uploader->upload('image')->save('images/articles');

                $data['image'] = $this->uploader->getFilename();
            }

            $data['user_id'] = \Auth::id();
            $data['slug'] = Str::slug($data['title']);
            $article->update($data);

            return $this->redirect(isOnPages() ? 'pages.index' : 'articles.index');
        } catch (ModelNotFoundException $e) {
            return $this->redirectNotFound();
        }
    }
858209
public function actionUpdate($id)
    {
        $model = $this->findModel($id);

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->session->setFlash('postSaved');
        }

        if ($model->type->show_category) {
            $model->setScenario('required_category');
        }

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