示例#1
0
 /**
  * Creates a new AuthItem model.
  *
  * If creation is successful, the browser will be redirected to the 'view' page.
  *
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new AuthItemModel();
     $model->type = $this->type;
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->session->setFlash('success', Yii::t('yii2mod.rbac', 'Item has been saved.'));
         return $this->redirect(['view', 'id' => $model->name]);
     }
     return $this->render('create', ['model' => $model]);
 }
示例#2
0
 /**
  * Creates a new AuthItem model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new AuthItemModel(null);
     $model->type = Item::TYPE_PERMISSION;
     if ($model->load(Yii::$app->getRequest()->post()) && $model->save()) {
         Yii::$app->session->setFlash('success', 'Permission has been saved.');
         return $this->redirect(['view', 'id' => $model->name]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }