From 70d469f0c8ed1c0dba1feb4aec9b63e9f14f72b3 Mon Sep 17 00:00:00 2001 From: DasunThathsara Date: Mon, 13 Nov 2023 20:29:35 +0530 Subject: [PATCH] Complete package CRUD --- app/controllers/ParkingOwner.php | 6 ++++++ app/models/ParkingOwnerModel.php | 12 ++++++++++++ app/views/parkingOwner/land.php | 4 ++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/controllers/ParkingOwner.php b/app/controllers/ParkingOwner.php index 83bcfbe8..702e026f 100644 --- a/app/controllers/ParkingOwner.php +++ b/app/controllers/ParkingOwner.php @@ -355,6 +355,12 @@ public function gotoLand($land_ID = null, $land_name = null){ $lands = $this->parkingOwnerModel->viewLands(); + $data = [ + 'id' => $land_ID, + 'name' => $land_name, + 'package_count' => $this->parkingOwnerModel->getPackageCount($data) + ]; + $this->view('parkingOwner/land', $data, $lands); } diff --git a/app/models/ParkingOwnerModel.php b/app/models/ParkingOwnerModel.php index a31ae18b..f7dbe754 100644 --- a/app/models/ParkingOwnerModel.php +++ b/app/models/ParkingOwnerModel.php @@ -295,4 +295,16 @@ public function updatePackage($data): bool return false; } } + + public function getPackageCount($data){ + // Prepare statement + $this->db->query('SELECT COUNT(*) FROM package WHERE pid = :pid'); + + // Bind values + $this->db->bind(':pid', $data['id']); + + + $row = $this->db->single(); + return $row->{'COUNT(*)'}; + } } \ No newline at end of file diff --git a/app/views/parkingOwner/land.php b/app/views/parkingOwner/land.php index 10846193..3997427d 100644 --- a/app/views/parkingOwner/land.php +++ b/app/views/parkingOwner/land.php @@ -117,8 +117,8 @@ -

3

-

Total Registered Users

+

+

Packages