Ejemplo n.º 1
0
 public function actionTypeadd()
 {
     $model = new GoodsType();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->getSession()->setFlash('info', '添加成功!');
         return $this->redirect(['typelist']);
     }
 }
Ejemplo n.º 2
0
 /**
  * Creates a new GoodsType model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     if (!$this->is_access('goodstype/create')) {
         Yii::$app->session->setFlash('error', $this->errorInfo);
         return $this->redirect($this->redirectUrl);
     }
     $model = new GoodsType();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->session->setFlash('success', '添加成功');
         return $this->redirect(['index']);
     } else {
         Yii::$app->view->params['meta_title'] = '新建商品类型';
         return $this->render('create', ['model' => $model]);
     }
 }