-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.php
39 lines (30 loc) · 1.27 KB
/
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
namespace uranium\core;
use uranium\core\RouteRegister;
use uranium\core\Route;
// Middlewares
use uranium\middleware\CheckAuthentication;
use uranium\middleware\CheckCSRF;
use uranium\middleware\RequireLogin;
class routes extends RouteRegister{
public function __construct(){
// Loggedin dashboard
$this->register($this->get("/", "pageController@index"));
$this->register($this->get("/dashboard", "pageController@dashboard")
->middleware(RequireLogin::class));
// Login
$this->register($this->get("/login", "pageController@login")
->middleware(CheckAuthentication::class));
$this->register($this->post("/login", "userController@loginUser")
->middleware(CheckCSRF::class)
->middleware(CheckAuthentication::class));
// Register
$this->register($this->get("/register", "pageController@register")
->middleware(CheckAuthentication::class));
$this->register($this->post("/register", "userController@createUser")
->middleware(CheckCSRF::class)
->middleware(CheckAuthentication::class));
// Logout
$this->register($this->get("/logout", "userController@destroySession"));
}
}