/**
  * Creates a new AdminRole model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @throws UserError if this model generate errors.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new AdminRole();
     $identity = $this->user->identity;
     if ($this->isPost) {
         $model->attributes = $this->request->post($model->formName(), []);
         $model->admin_id = $identity->id;
         $model->admin_path = $identity->parent_path . $identity->id;
         if ($model->save()) {
             if (Yii::$app->response->acceptMimeType == 'application/json') {
                 return ['pk' => $model->id, 'data' => $model->toArray()];
             } elseif (Yii::$app->response->acceptMimeType == 'text/grid') {
                 return $this->search(['id' => $model->id]);
             } else {
                 return $this->redirect(['index']);
             }
         } else {
             if ($this->isAjax) {
                 throw new UserError($model->getErrors());
             } else {
                 goto REN;
             }
         }
     } else {
         REN:
         return $this->render('create', ['model' => $model, 'displayAcls' => Yii::$app->menu->displayAcls($identity->admin_role_id)]);
     }
 }