Skip to content

Commit

Permalink
Merge pull request #245 from wanderlust-group-project-1/db_merge
Browse files Browse the repository at this point in the history
fix:urls cases
  • Loading branch information
nsavinda authored Apr 27, 2024
2 parents 4ea9f93 + 7da398e commit ff98c61
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
37 changes: 37 additions & 0 deletions app/controllers/GuideProfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

class GuideProfile {
use Controller;

public function index(string $a = '', string $b = '', string $c = ''): void {
$user = $_SESSION['USER'];
echo "a";

if ($user->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();
}

}

?>
4 changes: 2 additions & 2 deletions app/controllers/Guideprofile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/models/GuideProfile.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class GuideprofileModel {
class GuideProfileModel {
use Model;

protected string $table = 'guide_profile';
Expand Down
4 changes: 2 additions & 2 deletions app/views/guide/layout/guide-sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
</li>

<li class="nav-item">
<a class="nav-link" data-bs-toggle="collapse" href="<?php echo ROOT_DIR ?>/guideavailability" aria-expanded="false" aria-controls="ui-basic">
<a class="nav-link" data-bs-toggle="collapse" href="<?php echo ROOT_DIR ?>/guideAvailability" aria-expanded="false" aria-controls="ui-basic">
<i class="ti-palette menu-icon"></i>
<span class="menu-title">Availability</span>
<i class="menu-arrow"></i>
Expand All @@ -81,7 +81,7 @@
</li>

<li class="nav-item">
<a class="nav-link" data-bs-toggle="collapse" href="<?php echo ROOT_DIR ?>/guidebookings" aria-expanded="false" aria-controls="ui-basic">
<a class="nav-link" data-bs-toggle="collapse" href="<?php echo ROOT_DIR ?>/guideBookings" aria-expanded="false" aria-controls="ui-basic">
<i class="ti-palette menu-icon"></i>
<span class="menu-title">Bookings</span>
<i class="menu-arrow"></i>
Expand Down

0 comments on commit ff98c61

Please sign in to comment.