/** * 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' => (string)$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 "Success"; } else { return $this->renderPartial('_form', [ 'model' => $model, ]); } }