From 286dc15f6146a9f70107fd0087199038e67799de Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sun, 5 May 2024 16:09:23 -0400 Subject: [PATCH] member dash --- app/Controllers/Users.php | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/app/Controllers/Users.php b/app/Controllers/Users.php index 77eed1e..0ab658d 100644 --- a/app/Controllers/Users.php +++ b/app/Controllers/Users.php @@ -17,16 +17,31 @@ class Users extends BaseController } public function userDash(){ + $in = $this->request->getGet(); + $data = []; + if ($in['uid'] !=''){ + $query = $this->db->query("SELECT * FROM customers WHERE uid = '".$in['uid']."' "); - $data = [ - 'firstname' => 'Olarewaju', - 'lastname' => 'Jackson', - 'loan_status' => '0', - ]; + $row = $query->getRowArray(); + $data = [ + 'call_return' => '100', + 'customer' => $row, + 'loans' => $this->userLoan($in['uid']) + ]; + return $this->respond($data, 200); + } - return $this->respond($data, 200); + return $this->respond([], 400); } + private function userLoan($uid){ + $query = $this->db->query("SELECT a.uid AS application_uid,a.loan_amount, + a.payment_month,a.status,a.added, + a.updated + FROM applications a + LEFT JOIN customers c ON c.uid = a.customer_uid WHERE a.customer_uid='".$uid."' "); + return $query->getResult('array'); + } public function userProfile(){ $in = $this->request->getGet(); $data = []; @@ -40,7 +55,7 @@ class Users extends BaseController return $this->respond($data, 200); } - + return $this->respond([], 400); } } \ No newline at end of file