public function actionCreate()
    {
        if (!\Yii::$app->user->can('create'))
            return $this->alert(Module::t('core', 'Access denied.'));

        $model = new Rubric();
        $request = \Yii::$app->getRequest();
        $loaded = $model->load($request->post());
        
        // prependTo() call validate() and save()
        if ($loaded && $model->prependTo($this->findModel($model->parent_node))) {
            return $this->redirect(['index']);
        } else {
            return $this->renderAjax('create', [
                'model' => $model,
            ]);
        }
    }
public function actionCreate()
    {
        if (!\Yii::$app->user->can('create'))
            return $this->alert(Module::t('core', 'Access denied.'));

        $model = new Rubric();
        $request = \Yii::$app->getRequest();
        $loaded = $model->load($request->post());
        
        // prependTo() call validate() and save()
        if ($loaded && $model->prependTo($this->findModel($model->parent_node))) {
            return $this->redirect(['index']);
        } else {
            return $this->renderAjax('create', [
                'model' => $model,
            ]);
        }
    }
public function actionCreate ( ) { if ( ! \ Yii :: $ app -> user -> can ( 'create' ) ) return $ this -> alert ( Module :: t ( 'core' , 'Access denied.' ) ) ; $ model = new Rubric ( ) ; $ request = \ Yii :: $ app -> getRequest ( ) ; $ loaded = $ model -> load ( $ request -> post ( ) ) ; // prependTo() call validate() and save() if ( $ loaded && $ model -> prependTo ( $ this -> findModel ( $ model -> parent_node ) ) ) { return $ this -> redirect ( [ 'index' ] ) ; } else { return $ this -> renderAjax ( 'create' , [ 'model' => $ model , ] ) ; } }
Creates a new Rubric model.
If creation is successful, the browser will be redirected to the 'index' page.
@return mixed
Creates a new Rubric model . If creation is successful the browser will be redirected to the index page .