Beispiel #1
0
 /**
  * 新建
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Manager(['scenario' => 'create']);
     if (Yii::$app->request->post() && $model->load(Yii::$app->request->post())) {
         if (Yii::$app->request->post($model->formName())['password_hash']) {
             $model->password_hash = md5(Yii::$app->request->post($model->formName())['password_hash']);
             $model->generateAuthKey();
         }
         $this->saveAvatar($model);
         $model->validate();
         if ($model->save()) {
             return $this->redirect(['view', 'id' => $model->id]);
         }
     }
     return $this->render('create', ['model' => $model]);
 }