Ejemplo n.º 1
0
 /**
  * Creates a new UserInfo model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new UserInfo();
     $modelSignUp = new SignupForm();
     $arrSingup = Yii::$app->request->post("SignupForm");
     $modelSignUp->username = $arrSingup["username"];
     $modelSignUp->password = $arrSingup["password"];
     $modelSignUp->email = $arrSingup["email"];
     $arrUserInfo = Yii::$app->request->post("UserInfo");
     $model->load(Yii::$app->request->post());
     $user = $modelSignUp->signup();
     if ($user !== null) {
         $model = $this->findModel($user->id);
         $model->first_name = $arrUserInfo["first_name"];
         $model->last_name = $arrUserInfo["last_name"];
         $model->full_name = $arrUserInfo["full_name"];
         $model->phone = $arrUserInfo["phone"];
         $model->position = $arrUserInfo["position"];
         $model->manager = $arrUserInfo["manager"];
         if ($model->save()) {
             return $this->redirect(['view', 'id' => $model->user_id]);
         }
     }
     return $this->render('create', ['model' => $model, 'modelSignUp' => $modelSignUp]);
 }