/** * Updates an existing Setting model. * If update is successful, the browser will be redirected to the 'view' page. * @param string $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $model->name = Setting::encodeName($model->name); if ($model->load(Yii::$app->request->post())) { $model->name = Setting::encodeName($model->name); if ($model->validate()) { $model->data = HelperData::dataRemoveDoubleReturnsAndTrim($model->data); $model->save(false); //return $this->redirect(['view', 'id' => $model->id]); return $this->redirect(['index']); } } $model->data = HelperData::dataExplodeReturn($model->data); return $this->render('update', ['model' => $model]); }