From ece02595495734f1322f100176e96ae7fd6ed492 Mon Sep 17 00:00:00 2001 From: nsavinda Date: Mon, 30 Oct 2023 20:34:06 +0530 Subject: [PATCH] feat: user profile update --- app/controllers/Customer.php | 2 + app/models/Customer.php | 45 +++++ app/views/profile.view.php | 329 ----------------------------------- 3 files changed, 47 insertions(+), 329 deletions(-) delete mode 100755 app/views/profile.view.php diff --git a/app/controllers/Customer.php b/app/controllers/Customer.php index c921a734..f8160165 100644 --- a/app/controllers/Customer.php +++ b/app/controllers/Customer.php @@ -6,6 +6,8 @@ class Customer { public function update(string $a = '', string $b = '', string $c = ''):void { + $customer = new CustomerModel(); + $customer->updateCustomer($_POST); diff --git a/app/models/Customer.php b/app/models/Customer.php index 753f360a..3ac34536 100755 --- a/app/models/Customer.php +++ b/app/models/Customer.php @@ -71,4 +71,49 @@ public function validateCustomerSignup(array $data){ return empty($this->errors); } + + public function updateCustomer(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'); + + + + + + + + } + + // public function validateCustomerUpdate($data){ + // $this->errors = []; + + // if(empty($data['name'])){ + // $this->errors['name'] = "Name is required"; + // } + + // if(empty($data['address'])){ + // $this->errors['address'] = "Address is required"; + // } + + // if(empty($data['number'])){ + // $this->errors['number'] = "Number is required"; + // } + + // if(empty($data['nic'])){ + // $this->errors['nic'] = "NIC Number is required"; + // } + + // return empty($this->errors); + // } + + } diff --git a/app/views/profile.view.php b/app/views/profile.view.php deleted file mode 100755 index 844cb71d..00000000 --- a/app/views/profile.view.php +++ /dev/null @@ -1,329 +0,0 @@ - - -
- -
- -
- -
- -
-
- -
- -
-
- -
- -
-
-
Name : name ?>
-
-
-
NIC : nic ?>
-
-
-
Role : Customer
-
-
- -
-
-
Email : email ?>
-
-
-
Mobile : number ?>
-
-
-
Address : address ?>
-
-
- -
- -
- -
- - - - -
- -
-
- - - - - - - -
-
-
-
Total Booking
-
- -
-
-
03
-
- -
-
-
Equipment Booking
-
- -
-
-
02
-
- -
-
-
Guide Booking
-
- -
-
-
01
-
-
> - - - -
-
- -
- -
-
-
Recent Booking
-
- -
-
- -
-
-
Booking Type : Equipment Booking
-
-
-
Name : Glazers Camping
-
-
-
Date : 20/08/2023
-
-
-
Time : 10:00
-
- -
-
-
- - - -
-
- -
- -
Booking History
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameStatusTypeDateTime
Glazers CampingUpcomingEquipment02/12/202310.00
Glazers CampingUpcomingEquipment02/12/202310.00
SarathDoneGuide01/09/202310.00
-
-
-
- - - - - - - - - - - - - - - - - \ No newline at end of file