Пример #1
0
 /**
  * Updates an existing ModulesModules model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if (Yii::$app->request->isAjax) {
         Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
         return ActiveForm::validate($model);
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->cache->flush();
         if (Yii::$app->request->post('submit-type') == 'continue') {
             return $this->redirect(['update', 'id' => $model->module_id]);
         } else {
             return $this->redirect(['index']);
         }
     } else {
         return $this->render('update', ['model' => $model]);
     }
 }