/**
  * Creates a new Scoutparent model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Scoutparent();
     if ($model->load(Yii::$app->request->post())) {
         if (!Yii::$app->user->isGuest && !Yii::$app->user->identity->getIsScout() && !Yii::$app->user->identity->getIsParent()) {
             $auth = Yii::$app->authManager;
             $authorRole = $auth->getRole('parent');
             $auth->assign($authorRole, Yii::$app->user->getId());
         }
         $model->setAttribute('userid', Yii::$app->user->getId());
         if ($model->save()) {
             return $this->redirect(['/site/index']);
         } else {
             return $this->render('create', ['model' => $model]);
         }
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }