/** * Profile edit action * @param int $id * @return string * @throws \Ffcms\Core\Exception\SyntaxException * @throws \Ffcms\Core\Exception\NativeException * @throws NotFoundException */ public function actionUpdate($id) { if (!Obj::isLikeInt($id) || $id < 1) { throw new NotFoundException(); } // get user profile via id $profile = ProfileRecords::find($id); if (false === $profile || null === $profile) { throw new NotFoundException(); } // check if user id for this profile_id is exist if (!App::$User->isExist($profile->user_id)) { throw new NotFoundException(); } // get user object from profile $user = $profile->User(); $model = new FrontFormSettings($user); if ($model->send() && $model->validate()) { $model->save(); App::$Session->getFlashBag()->add('success', __('Profile is updated')); } return $this->view->render('update', ['model' => $model, 'user' => $user, 'profile' => $profile]); }