-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.php
executable file
·63 lines (47 loc) · 1.01 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
// This is subdomain
if ( $app->host_domain != APP_DOMAIN ) {
// We have this subdomain registered in the hosts table
if ( $app->getHost() ){
// Subdomain Home
$app->route('/', function() use ($app) {
echo $this->host_name;
});
// Everything else on subdomain
$app->route('/*', function() use ($app) {
// Return a 404 error
$app->http(404);
});
// We don't have this subdomain in the hosts table
} else {
$app->http(404);
}
// Primary Website
} else {
// Home
$app->route('/');
// Login
$app->route('/login');
// Logout
$app->route('/logout', function() use ($app) {
if ( $app->auth->isLoggedIn() ) {
$app->auth->logOut();
}
$app->redirect('/login');
});
// Create Account
$app->route('/create-account');
// Profile
$app->route('/profile');
// Admin Area
$app->route('/admin');
// API
$app->route('/api');
// Test
$app->route('/test');
// Everything else
$app->route('/*', function() use ($app) {
// Return a 404 error
$app->http(404);
});
}