/** * Creates a new Route model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Route(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['index']); } else { return $this->render('create', ['model' => $model]); } }
/** * 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 Route(); if ($model->load(Yii::$app->getRequest()->post())) { if ($model->validate()) { $routes = preg_split('/\\s*,\\s*/', trim($model->route), -1, PREG_SPLIT_NO_EMPTY); $this->saveNew($routes); MenuHelper::invalidate(); $this->redirect(['index']); } } return $this->render('create', ['model' => $model]); }