/** * This method accepts property type and adds the record. * Returns model if successfully created. * Returns the error validated model if validation fails. * * * @param string $type * @return model || model with errors */ public static function create($type) { $property_types = new PropertyTypes(); $property_types->property_type = $type; $property_types->save(); return $property_types; }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new PropertyTypes(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['PropertyTypes'])) { $model->attributes = $_POST['PropertyTypes']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }