public function init() { $this->layout = 'client_layout'; $imagesModel = new Image(); $this->logo = $imagesModel->getProfilePhoto(); $profile = $this->findModel(Yii::$app->user->id); $this->first_name = $profile->firstname; $this->last_name = $profile->lastname; $this->userModules = UsersModules::getUsersModules(); parent::init(); // custom initialization code goes here }
public function actionIndex() { $currentPsychologistId = Yii::$app->user->id; $profile = $this->findModel($currentPsychologistId); /* $directions = new Directions(); $problems = new Problems();*/ $imagesModel = new Image(); if ($profile->load(Yii::$app->request->post())) { if ($profile->save()) { return $this->render('index', ['profileModel' => $profile, 'message' => 'Профиль успешно обновлён', 'imagesModel' => $imagesModel, 'logo' => $imagesModel->getProfilePhoto()]); } } else { return $this->render('index', ['profileModel' => $profile, 'imagesModel' => $imagesModel]); } }