示例#1
0
 /**
  * Updates an existing Admin 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);
     $m = new \app\models\admin\ProfileForm($model);
     if ($m->load(Yii::$app->request->post()) && $m->validate() && $m->saveUser()) {
         return $this->redirect(['index']);
     }
     return $this->render('edit', compact('model', 'm'));
 }
示例#2
0
 public function actionProfile()
 {
     $model = new \app\models\admin\ProfileForm(Yii::$app->user->identity);
     if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->saveUser()) {
         Yii::$app->session->setFlash('profile.success', true);
         return $this->refresh();
     }
     return $this->render('profile', compact('model'));
 }