public function actionProfile()
    {
        /** @var User $user */
        $user = Yii::$app->getUser()->getIdentity();
        $model = new MultiModel([
            'models' => [
                'user' => $user,
                'profile' => $user->profile,
            ],
        ]);

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->session->addFlash('success', Yii::t('maddoger/user', 'Changes have been saved.'));
            return $this->refresh();
        } else {
            return $this->render('profile', [
                'model' => $model,
            ]);
        }
    }
public function actionProfile()
    {
        /** @var User $user */
        $user = Yii::$app->getUser()->getIdentity();
        $model = new MultiModel([
            'models' => [
                'user' => $user,
                'profile' => $user->profile,
            ],
        ]);

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->session->addFlash('success', Yii::t('maddoger/user', 'Changes have been saved.'));
            return $this->refresh();
        } else {
            return $this->render('profile', [
                'model' => $model,
            ]);
        }
    }
public function actionProfile ( ) { /** @var User $user */ $ user = Yii :: $ app -> getUser ( ) -> getIdentity ( ) ; $ model = new MultiModel ( [ 'models' => [ 'user' => $ user , 'profile' => $ user -> profile , ] , ] ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { Yii :: $ app -> session -> addFlash ( 'success' , Yii :: t ( 'maddoger/user' , 'Changes have been saved.' ) ) ; return $ this -> refresh ( ) ; } else { return $ this -> render ( 'profile' , [ 'model' => $ model , ] ) ; } }
Updates own profile.
If update is successful, the browser will be redirected to the 'view' page.
@return mixed
Updates own profile . If update is successful the browser will be redirected to the view page .