Skip to content

Commit

Permalink
Merge pull request #138 from DasunThathsara/dasun
Browse files Browse the repository at this point in the history
Complete package CRUD
  • Loading branch information
DasunThathsara authored Nov 13, 2023
2 parents af8401c + 70d469f commit 62a62ec
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
6 changes: 6 additions & 0 deletions app/controllers/ParkingOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
12 changes: 12 additions & 0 deletions app/models/ParkingOwnerModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(*)'};
}
}
4 changes: 2 additions & 2 deletions app/views/parkingOwner/land.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
<img src="<?php echo URLROOT ?>/images/package.svg" alt="">
</th>
<td>
<p>3</p>
<p>Total Registered Users</p>
<p><?php echo $data['package_count'] ?></p>
<p>Packages</p>
</td>
</tr>
</table>
Expand Down

0 comments on commit 62a62ec

Please sign in to comment.