Пример #1
0
 public function actionProfileEdit()
 {
     $model = $this->findModel(Yii::$app->getRequest()->getCookies()->getValue('userId'));
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['profile']);
     } else {
         return $this->render('@app/modules/user/views/user/update2', ['model' => $model, 'statuses' => $model->getStatuses(), 'roles' => AuthItem::getRoles()]);
     }
 }
Пример #2
0
 /**
  * Updates an existing User model.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if (Yii::$app->request->isPost) {
         $model->load(Yii::$app->request->post());
         Yii::$app->response->format = 'json';
         if ($model->save()) {
             return Yii::$app->params['response']['success'];
         } else {
             return ActiveForm::validate($model);
         }
     } else {
         return $this->renderAjax('update', ['model' => $model, 'roles' => AuthItem::getRoles()]);
     }
 }