Exemplo n.º 1
0
 /**
  * Creates a new Products model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Products();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Creates a new Products model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Products();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['/products', 'SearchProducts[cat_id]' => $model->cat_id]);
     } else {
         return $this->render('create', ['model' => $model, 'cat_id' => Yii::$app->request->queryParams["cat_id"]]);
     }
 }