/** * Creates a new Municipio model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Municipio(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->muni_codigo]); } else { return $this->render('create', ['model' => $model]); } }
/** * Updates Municipio into database * * @param Municipio $municipio * @param array $input * * @return Municipio */ public function update($municipio, $input) { $municipio->fill($input); $municipio->save(); return $municipio; }