/** * Create new menu and menu items. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new WidgetMenu(); if ($model->load(Yii::$app->request->post()) && $model->save() && $model->setItems(Yii::$app->request->post($model->formName()))) { return $this->redirect(['update', 'id' => $model->id]); } return $this->render('create', ['model' => $model->loadDefaultValues()]); }
/** * Creates a new WidgetMenu model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new WidgetMenu(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['index']); } else { return $this->render('create', ['model' => $model]); } }