/** * Creates a new Institucion model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Institucion(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
/** * Creates a new Institucion model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Institucion(); $dir = new Direccion(); if ($model->load(Yii::$app->request->post()) && $dir->load(Yii::$app->request->post())) { $model->save(); $dir->Institucionid_institucion = $model->id_institucion; if ($dir->save()) { return $this->redirect(['view', 'id' => $model->id_institucion]); } else { return $this->redirect(['index', 'id' => $model->id_institucion]); } } else { return $this->render('create', ['model' => $model, 'dir' => $dir]); } }