Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
all: add a barebones dashboard controller
app/controllers/DashboardController.php | 7 +++++++ app/views/dashboard.php | 4 ++++ config/routes.php | 5 +++++
diff --git a/app/controllers/DashboardController.php b/app/controllers/DashboardController.php new file mode 100644 index 0000000000000000000000000000000000000000..68b7184c664078dbcc6ae811a13993eaf363e8e9 --- /dev/null +++ b/app/controllers/DashboardController.php @@ -0,0 +1,7 @@ +<?php + +class DashboardController { + public function index() { + return Template::render('dashboard'); + } +} diff --git a/app/views/dashboard.php b/app/views/dashboard.php new file mode 100644 index 0000000000000000000000000000000000000000..a6fd7a7338fec3dda0116b5fbdc32ed1d2cac3c7 --- /dev/null +++ b/app/views/dashboard.php @@ -0,0 +1,4 @@ +<?php + +echo "<div class='flex w-full'>" . $_SESSION['user_id'] . "</div>"; +echo "<div class='flex w-full'>" . $_SESSION['user_email'] . "</div>"; diff --git a/config/routes.php b/config/routes.php index b84b48c31c62cf39ed8726954f370a78eef2d068..699eaaac8ce184992a1f99d081c29094a55f323a 100644 --- a/config/routes.php +++ b/config/routes.php @@ -3,6 +3,7 @@ // TODO: Usar um autoload aqui require_once '../app/controllers/HelloController.php'; require_once '../app/controllers/AuthController.php'; +require_once '../app/controllers/DashboardController.php'; return function() { $uri = trim($_SERVER['REQUEST_URI'], '/'); @@ -27,6 +28,10 @@ // GET /register } elseif ($uri === 'register') { return (new HelloController())->register(); + + // GET /dashboard + } elseif ($uri === 'dashboard') { + return (new DashboardController())->index(); // GET /logout } elseif ($uri === 'logout') {