forked from simplemvc/skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Route.php
executable file
·52 lines (44 loc) · 2.28 KB
/
Route.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
<?php
/**
* Skeleton application for SimpleMVC
*
* @link http://github.com/simplemvc/skeleton
* @copyright Copyright (c) Enrico Zimuel (https://www.zimuel.it)
* @license https://opensource.org/licenses/MIT MIT License
*/
declare(strict_types=1);
namespace App\Config;
use App\Controller;
use App\Controller\Admin;
use SimpleMVC\Controller\BasicAuth;
class Route
{
public const LOGIN = '/login';
public const LOGOUT = '/logout';
public const DASHBOARD = '/admin/users';
public static function getRoutes(): array
{
return [
//[ 'GET', '/', Controller\Home::class ],
[ 'GET', '/', Controller\Blog::class ],
[ 'GET', '/hello[/{name}]', Controller\Hello::class ],
[ ['GET', 'POST'], self::LOGIN, Controller\Login::class ],
[ 'GET', self::LOGOUT, Controller\Logout::class ],
[ 'GET', '/basic-auth', [BasicAuth::class, Controller\Secret::class]],
// Admin section
[ 'GET', '/admin/users[/{id}]', [Controller\AuthSession::class, Admin\Users\Read::class]],
[ 'POST', '/admin/users/{id}', [Controller\AuthSession::class, Admin\Users\Update::class]],
[ 'POST', '/admin/users', [Controller\AuthSession::class, Admin\Users\Create::class]],
[ 'DELETE', '/admin/users/{id}', [Controller\AuthSession::class, Admin\Users\Delete::class]],
[ 'POST', '/admin/posts', [Controller\AuthSession::class, Admin\Posts\Create::class]],
[ 'GET', '/admin/posts[/{id}]', [Controller\AuthSession::class, Admin\Posts\Read::class]],
[ 'POST', '/admin/posts/{id}', [Controller\AuthSession::class, Admin\Posts\Update::class]],
[ 'DELETE', '/admin/posts/{id}', [Controller\AuthSession::class, Admin\Posts\Delete::class]],
[ 'POST', '/admin/categories', [Controller\AuthSession::class, Admin\Categories\Create::class]],
[ 'GET', '/admin/categories[/{id}]', [Controller\AuthSession::class, Admin\Categories\Read::class]],
[ 'POST', '/admin/categories/{id}', [Controller\AuthSession::class, Admin\Categories\Update::class]],
[ 'DELETE', '/admin/categories/{id}', [Controller\AuthSession::class, Admin\Categories\Delete::class]],
//[ 'GET', '/admin/seed', [Controller\AuthSession::class, Admin\Posts\Read::class]],
];
}
}