/** * To edit the record information (User Profile) * @param long $id : To get the particular user's id * @return : the view of edit User form */ public function actionEdit($id = NULL) { if (!Yii::$app->user->isGuest) { $model = Setting::findOne(['id' => $_POST['id']]); if (isset($model) && !empty($model)) { $model->value = $_POST['value']; Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; return $model->update(false) ? ['status' => 'success'] : ['status' => 'failure']; } else { Yii::$app->session->setFlash("danger", 'Invalid Setting', true); $this->refresh(); } } else { Yii::$app->session->setFlash("danger", 'You have to be looged in to perform any private operation', true); $this->redirect(Url::to(['/usermgmt/user/index'])); } }