-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.php
26 lines (19 loc) · 918 Bytes
/
routes.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
<?php
use Phroute\Phroute\RouteCollector;
// create route filter
$router->filter('auth', function () {
if (!isset($_SESSION['user'])) {
errMsg("Invalid attempt. You must be authenticated.", "login");
}
});
$router->controller('/', App\Controllers\Frontend\HomeController::class);
$router->controller('/cart', App\Controllers\Frontend\CartController::class);
$router->group(['before' => 'auth'], function($router){
$router->controller('/checkout', App\Controllers\Frontend\CheckoutController::class);
});
// route filter applied
$router->group(['before' => 'auth', 'prefix' => 'dashboard'], function (RouteCollector $router) {
$router->controller('/', App\Controllers\Backend\DashboardController::class);
$router->controller('/categories', App\Controllers\Backend\CategoryController::class);
$router->controller('/products', App\Controllers\Backend\ProductController::class);
});