Example #1
0
 /**
  * Creates a new Ninio model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($id)
 {
     $model = new Ninio();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         //return $this->redirect(['view', 'id' => $model->id_nin]);
         //Modificar con el ID del indicador en la encuesta
         $model_encuesta = \app\models\Factencuesta::findOne($id);
         $model_encuesta->id_nin = $model->id_nin;
         $model_encuesta->save();
         return $this->redirect(['nutricion/create', 'id' => $id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }