diff --git a/app/controllers/Customer.php b/app/controllers/Customer.php index 1a943960..58674cf2 100755 --- a/app/controllers/Customer.php +++ b/app/controllers/Customer.php @@ -9,8 +9,6 @@ public function update(string $a = '', string $b = '', string $c = ''):void { $customer = new CustomerModel(); $customer->updateCustomer($_POST); - - redirect('profile'); // $this->view('customer/profile'); } diff --git a/app/controllers/Guide.php b/app/controllers/Guide.php index a4e54b21..9b0fc692 100755 --- a/app/controllers/Guide.php +++ b/app/controllers/Guide.php @@ -11,5 +11,14 @@ public function find(string $a = '', string $b = '', string $c = ''):void { $this->view('guide/find'); } + public function update(string $a = '', string $b = '', string $c = ''): void + { + + $guide = new guideModel(); + $guide->updateGuide($_POST); + + redirect('dashboard'); + // $this->view('customer/profile'); + } } \ No newline at end of file diff --git a/app/models/Guide.php b/app/models/Guide.php index 5eb75d15..aac5f716 100755 --- a/app/models/Guide.php +++ b/app/models/Guide.php @@ -1,6 +1,7 @@ validateGuideSignup($data)) { $user = new UserModel; @@ -35,7 +37,8 @@ public function registerGuide(array $data) { return false; } - public function validateGuideSignup(array $data) { + public function validateGuideSignup(array $data) + { $this->errors = []; if (empty($data['name'])) { @@ -72,4 +75,19 @@ public function validateGuideSignup(array $data) { return empty($this->errors); } + + public function updateGuide(array $data) + { + + // $user = new UserModel; + + $data['id'] = $_SESSION['USER']->id; + + // alowed column + $data = array_filter($data, function ($key) { + return in_array($key, $this->allowedColumns); + }, ARRAY_FILTER_USE_KEY); + + return $this->update($_SESSION['USER']->id, $data, 'id'); + } } diff --git a/app/views/customer/profile.view.php b/app/views/customer/profile.view.php index 844cb71d..40ad66dc 100755 --- a/app/views/customer/profile.view.php +++ b/app/views/customer/profile.view.php @@ -4,92 +4,92 @@ require_once('../app/views/components/navbar.php'); ?> -
+
-
+
-
- -
+
+ +
-
-
- -
- -
+
+
+
Hello name ?>!
+
+
+
-
+ -
-
-
Name : name ?>
-
-
-
NIC : nic ?>
-
-
-
Role : Customer
-
+
+
+
Name : name ?>
- -
-
-
Email : email ?>
-
-
-
Mobile : number ?>
-
-
-
Address : address ?>
-
+
+
NIC : nic ?>
+
+
Role : Customer
+
+
- +
+
+
Email : email ?>
+
+
+
Mobile : number ?>
+
+
+
Address : address ?>
+
+
-
+
+
+ + + +
+