Exemplo n.º 1
0
 /**
  * Creates a new Menu record model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new MenuRecord();
     $model->web_id = $this->_web->id;
     $model->initBoxes();
     if ($model->load(Yii::$app->request->post())) {
         $model->setBoxesProperties();
         if ($model->save()) {
             $session = Yii::$app->session;
             $session->setFlash('info', Yii::t('back', 'Menu successfully added!'));
             return $this->redirect(['index']);
         }
     } elseif (Yii::$app->request->isAjax) {
         return $this->renderAjax('_form', compact('model'));
     }
     return $this->render('_form', compact('model'));
 }