コード例 #1
0
 /**
  * @return string|\yii\web\Response
  */
 public function actionProfile()
 {
     if ($this->module->profileLayout) {
         $this->layout = $this->module->profileLayout;
     }
     if (Yii::$app->user->isGuest) {
         throw new NotFoundHttpException(Yii::t('yii', 'Page not found.'));
     }
     $model = User::findIdentity(Yii::$app->user->id);
     if ($model->load(Yii::$app->request->post()) and $model->save()) {
         Yii::$app->session->setFlash('success', Yii::t('yii', 'Your item has been updated.'));
     }
     return $this->renderIsAjax('profile', compact('model'));
 }