/** * 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')); }
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')); }