/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Producer(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Producer'])) { $model->attributes = $_POST['Producer']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id_producer)); } } $this->render('create', array('model' => $model)); }
/** * */ public function actionCreate() { $model = new Producer(); $data = Yii::app()->getRequest()->getPost('Producer'); if (!is_null($data)) { $model->setAttributes($data); if ($model->save()) { Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('StoreModule.store', 'Record was created!')); $this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', ['create'])); } } $this->render('create', ['model' => $model]); }
public function actionCreate() { $model = new Producer(); if (isset($_POST['Producer'])) { $model->setAttributes($_POST['Producer']); if ($model->save()) { if (Yii::app()->getRequest()->getIsAjaxRequest()) { Yii::app()->end(); } else { $this->redirect(array('view', 'id' => $model->id)); } } } $this->render('create', array('model' => $model)); }
public function actionCreate() { $model = new Producer(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Producer'])) { $model->attributes = $_POST['Producer']; if ($model->save()) { Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('StoreModule.producer', 'Запись добавлена!')); if (!isset($_POST['submit-type'])) { $this->redirect(['update', 'id' => $model->id]); } else { $this->redirect([$_POST['submit-type']]); } } } $this->render('create', ['model' => $model]); }