コード例 #1
0
 /**
  * Creates a new Loaisanpham model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Loaisanpham();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect('index.php?r=loaisanpham%2Findex');
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #2
0
 /**
  * Creates a new Loaisanpham model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Loaisanpham();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->loaisanpham_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #3
0
 public function actionCreate()
 {
     $model = new Loaisanpham();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->validate()) {
             $model->status = 1;
             if ($model->save()) {
                 return $this->redirect(['loaisanpham/index']);
             }
             return $this->render('create', ['user' => $model, 'msg' => 'have some error!!!']);
         }
     } else {
         return $this->render('create', ['user' => $model]);
     }
 }