Example #1
0
 /**
  * Creates a new Person model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Person();
     if ($model->load(Yii::$app->request->post())) {
         $model->password = Yii::$app->security->generatePasswordHash($model->password);
         $model->save();
         return $this->redirect(['index', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }