diff --git a/app/controllers/GuideProfile.php b/app/controllers/GuideProfile.php new file mode 100644 index 0000000..50e065f --- /dev/null +++ b/app/controllers/GuideProfile.php @@ -0,0 +1,37 @@ +role == 'guide') { + $guideProfileModel = new GuideProfileModel(); + $guideProfile = $guideProfileModel->getGuideProfileByUserId($user->id); // Assuming you have a method to fetch guide profile by user ID + $this->view('guide/guideprofile', ['user' => $user, 'guideProfile' => $guideProfile]); + } + } + + public function update(string $a = '', string $b = '', string $c = ''): void { + $request = new JSONRequest; + $response = new JSONResponse; + + $data = $request->getAll(); + $data['guide_id'] = UserMiddleware::getUser()['id']; + + $guideProfileModel = new GuideProfileModel; + $data = $guideProfileModel->updateGuideProfile($data); + + $response + ->data($data) + ->success(true) + ->message('Profile updated successfully') + ->statusCode(200) + ->send(); + } + +} + +?> \ No newline at end of file diff --git a/app/controllers/Guideprofile.php b/app/controllers/Guideprofile.php index 92215a5..f8c50cc 100644 --- a/app/controllers/Guideprofile.php +++ b/app/controllers/Guideprofile.php @@ -7,7 +7,7 @@ public function index(string $a = '', string $b = '', string $c = ''): void { $user = $_SESSION['USER']; if ($user->role == 'guide') { - $guideProfileModel = new GuideprofileModel(); + $guideProfileModel = new GuideProfileModel(); $guideProfile = $guideProfileModel->getGuideProfileByUserId($user->id); // Assuming you have a method to fetch guide profile by user ID $this->view('guide/guideprofile', ['user' => $user, 'guideProfile' => $guideProfile]); } @@ -20,7 +20,7 @@ public function update(string $a = '', string $b = '', string $c = ''): void { $data = $request->getAll(); $data['guide_id'] = UserMiddleware::getUser()['id']; - $guideProfileModel = new GuideprofileModel; + $guideProfileModel = new GuideProfileModel; $data = $guideProfileModel->updateGuideProfile($data); $response diff --git a/app/models/GuideProfile.php b/app/models/GuideProfile.php index 27a8873..e6e2ecf 100644 --- a/app/models/GuideProfile.php +++ b/app/models/GuideProfile.php @@ -1,6 +1,6 @@