/** * 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]); } }
/** * 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]); } }
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]); } }