예제 #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();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $model->setPassword($model->password_hash);
         $model->created_at = time();
         $model->updated_at = time();
         $model->status = 10;
         $model->generatePasswordResetToken();
         $model->generateAuthKey();
         $model->save();
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }