ref: master
app/controllers/DashboardController.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<?php require_once __DIR__ . '/../daos/BillDAO.php'; require_once __DIR__ . '/../daos/DashboardDAO.php'; class DashboardController { private $dashboardDAO; private $billDAO; public function __construct() { $this->dashboardDAO = new DashboardDAO(); $this->billDAO = new BillDAO(); } public function index() { $bills = $this->billDAO->findAllByUserId($_SESSION['user_id']); $balance = $this->dashboardDAO->balance($_SESSION['user_id']); $data = [ 'bills' => $bills, 'balance' => $balance ]; return Template::render('dashboard', $data); } } |