dektrium\rbac\controllers\RuleController::actionCreate PHP Method

actionCreate() public method

Shows page where new rule can be added.
public actionCreate ( ) : array | string
return array | string
    public function actionCreate()
    {
        $model = $this->getModel(Rule::SCENARIO_CREATE);
        if (\Yii::$app->request->isAjax && $model->load(\Yii::$app->request->post())) {
            \Yii::$app->response->format = Response::FORMAT_JSON;
            return ActiveForm::validate($model);
        }
        if ($model->load(\Yii::$app->request->post()) && $model->create()) {
            \Yii::$app->session->setFlash('success', \Yii::t('rbac', 'Rule has been added'));
            return $this->redirect(['index']);
        }
        return $this->render('create', ['model' => $model]);
    }