Example #1
0
 /**
  * Creates a new user.
  *
  * If creation is successful, the browser will be redirected to the 'index' page.
  *
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new UserModel(['scenario' => 'createUser']);
     if ($model->load(Yii::$app->request->post())) {
         if ($model->createUser()) {
             Yii::$app->session->setFlash('success', Yii::t('user', 'User has been created.'));
             return $this->redirect(['index']);
         }
     }
     return $this->render('create', ['model' => $model]);
 }