/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Organizations(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Organizations'])) { $model->attributes = $_POST['Organizations']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->organizationID)); } } $this->render('create', array('model' => $model)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Organizations(); if (isset($_POST['Organizations'])) { $model->attributes = $_POST['Organizations']; if ($model->save()) { Yii::app()->user->setFlash('success', Yii::t('main', 'Данные успешно сохранены!')); $this->redirect(array('update', 'id' => $model->id)); } else { Yii::app()->user->setFlash('error', Yii::t('main', 'Ошибка сохранения данных!')); } } $this->render('create', array('model' => $model)); }