/**
  * 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]);
 }
 /**
  * Updates an existing Action model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $model->data_structure = HelperData::dataTrim($model->data_structure);
         $model->data_structure = HelperData::dataImplodeReturn($model->data_structure);
         $model->save(false);
         //return $this->redirect(['view', 'id' => $model->id]);
         return $this->redirect(['index']);
     } else {
         $model->data_structure = HelperData::dataExplodeReturn($model->data_structure);
         // add device_ids to the model, that are joined to the action, it
         // set automaticly the default values of the device_ids
         $model->device_ids = $model->getDeviceActions();
         return $this->render('update', ['model' => $model]);
     }
 }