/**
  * Creates a new Admin model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Admin();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Creates Admin account
  *
  * @return Admin|null the saved model or null if saving fails
  */
 public function createAdmin()
 {
     if ($this->validate()) {
         $admin = new Admin();
         $admin->nicename = $this->nicename;
         $admin->username = $this->username;
         $admin->email = $this->email;
         $admin->role = $this->role;
         $admin->status = $this->status;
         $admin->setPassword($this->password);
         $admin->generateAuthKey();
         if ($admin->save()) {
             return $admin;
         }
     }
     return null;
 }