controllers/AdminController.php
public function actionUpdate($id)
    {
        $model = $this->findModel($id);
        $model->scenario = 'update';

        if ($model->load(\Yii::$app->request->post()) && $model->save()) {
            if(\Yii::$app->request->get('returnUrl')){
                $back = urldecode(\Yii::$app->request->get('returnUrl'));
                return $this->redirect($back);
            }

            \Yii::$app->getSession()->setFlash('block.success', \Yii::t('block', 'Block has been updated'));
            return $this->refresh();
        }

        return $this->render('update', [
            'model' => $model
        ]);
    }
public function actionUpdate($id)
    {
        $model = $this->findModel($id);
        $model->scenario = 'update';

        if ($model->load(\Yii::$app->request->post()) && $model->save()) {
            if(\Yii::$app->request->get('returnUrl')){
                $back = urldecode(\Yii::$app->request->get('returnUrl'));
                return $this->redirect($back);
            }

            \Yii::$app->getSession()->setFlash('block.success', \Yii::t('block', 'Block has been updated'));
            return $this->refresh();
        }

        return $this->render('update', [
            'model' => $model
        ]);
    }
public function actionUpdate ( $ id ) { $ model = $ this -> findModel ( $ id ) ; $ model -> scenario = 'update' ; if ( $ model -> load ( \ Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { if ( \ Yii :: $ app -> request -> get ( 'returnUrl' ) ) { $ back = urldecode ( \ Yii :: $ app -> request -> get ( 'returnUrl' ) ) ; return $ this -> redirect ( $ back ) ; } \ Yii :: $ app -> getSession ( ) -> setFlash ( 'block.success' , \ Yii :: t ( 'block' , 'Block has been updated' ) ) ; return $ this -> refresh ( ) ; } return $ this -> render ( 'update' , [ 'model' => $ model ] ) ; }
Updates an existing Block model.
If update is successful, the browser will be redirected to the 'index' page.
@param  integer $id
@return mixed
Updates an existing Block model . If update is successful the browser will be redirected to the index page .