/** * Creates a new Personal model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Personal(); 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 Applicant model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model1 = new Applicant(); $model2 = new Personal(); $model3 = new Academic(); if ($model1->load(Yii::$app->request->post()) && $model2->load(Yii::$app->request->post()) && $model3->load(Yii::$app->request->post()) && $model1->save() && $model2->save() && $model3->save()) { return $this->redirect(['view', 'id' => $model1->id]); } else { return $this->render('create', ['model1' => $model1, 'model2' => $model2, 'model3' => $model3]); } }
/** * (string|\yii\web\Response) actionCreate : Creates a new Personal model. * If creation is successful, the browser will be redirected to the 'view' page. * @param $unit * @return string|\yii\web\Response */ public function actionCreate($unit = '%') { $model = new Personal(); //var_dump(Yii::$app->request->post()); //return; if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['update', 'id' => $model->id]); } else { /** init personal attributes */ $model->s_date = date('Ymd'); $model->code1 = $model::getMaxCode(); $model->selfno = 0; $model->childnum = 0; $model->checktime = 0; $model->e_date = '29990101'; $model->unit = $unit; $model->personal_id = Personal::generatePersonal_id($unit); return $this->render('create', ['model' => $model, 'unitname' => Unit::getUnitnameByUnitcode($unit)]); } }