/** * 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_ROLE; if ($model->load(Yii::$app->getRequest()->post()) && $model->save()) { Yii::$app->session->setFlash('success', 'Role has been saved.'); return $this->redirect(['view', 'id' => $model->name]); } else { return $this->render('create', ['model' => $model]); } }
/** * @return \yii\db\ActiveQuery */ public function getItemName() { return $this->hasOne(AuthItemModel::className(), ['name' => 'item_name']); }