예제 #1
0
 /**
  * Creates a new User model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new User();
     $pi = new PersonalInformation();
     if ($pi->load(Yii::$app->request->post())) {
         /*print_r($this->pi_name);
           die();*/
         /*$pi = new PersonalInformation();
           $pi->load(Yii::$app->request->post());*/
         $pi->pi_name = $pi->pi_name;
         $pi->save();
         if ($pi->save() == 1) {
             // this is inserted user id
             //$model = new User();
             $model->load(Yii::$app->request->post());
             /*print_r($model);
               //print_r($pi);
               die();*/
             $userID = $pi->pi_id;
             $model->pi_id = $userID;
             $model->username = $model->username;
             $model->status = $model->status;
             $model->online_status = "0";
             $model->created_at = time();
             $model->updated_at = time();
             $model->auth_key = "vBZS7KGrvXesyOkgQhGYCY5KCZi6st5g";
             $model->password_hash = "\$2y\$13\$4cRqqw0nmEj5.NJRcJYaE.YUSh9DJaQsSpLM3OCicXckrCPoAgWYC";
             $model->save();
             /*print_r($model->getErrors());
               die();*/
         }
         return $this->redirect(['index', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }