/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Accesory(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Accesory'])) { $model->attributes = $_POST['Accesory']; if ($model->save()) { if (!empty($_POST['yt1'])) { Yii::app()->user->setFlash('accesory-created', "¡El accesorio <b><i>"{$model->name}"</i></b> fue creada exitosamente!"); $model = new Accesory(); } else { $this->redirect(array('view', 'id' => $model->id)); } } } $this->render('create', array('model' => $model)); }