|
1
|
|
|
<?php |
|
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Routes configuration. |
|
|
|
|
|
|
5
|
|
|
* |
|
6
|
|
|
* In this file, you set up routes to your controllers and their actions. |
|
7
|
|
|
* Routes are very important mechanism that allows you to freely connect |
|
8
|
|
|
* different URLs to chosen controllers and their actions (functions). |
|
9
|
|
|
* |
|
10
|
|
|
* It's loaded within the context of `Application::routes()` method which |
|
11
|
|
|
* receives a `RouteBuilder` instance `$routes` as method argument. |
|
12
|
|
|
* |
|
13
|
|
|
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org) |
|
14
|
|
|
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) |
|
15
|
|
|
* |
|
16
|
|
|
* Licensed under The MIT License |
|
17
|
|
|
* For full copyright and license information, please see the LICENSE.txt |
|
18
|
|
|
* Redistributions of files must retain the above copyright notice. |
|
19
|
|
|
* |
|
20
|
|
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) |
|
|
|
|
|
|
21
|
|
|
* @link https://cakephp.org CakePHP(tm) Project |
|
|
|
|
|
|
22
|
|
|
* @license https://opensource.org/licenses/mit-license.php MIT License |
|
|
|
|
|
|
23
|
|
|
*/ |
|
|
|
|
|
|
24
|
|
|
use Cake\Routing\Route\DashedRoute; |
|
25
|
|
|
use Cake\Routing\RouteBuilder; |
|
26
|
|
|
|
|
27
|
|
|
/* |
|
28
|
|
|
* The default class to use for all routes |
|
29
|
|
|
* |
|
30
|
|
|
* The following route classes are supplied with CakePHP and are appropriate |
|
31
|
|
|
* to set as the default: |
|
32
|
|
|
* |
|
33
|
|
|
* - Route |
|
34
|
|
|
* - InflectedRoute |
|
35
|
|
|
* - DashedRoute |
|
36
|
|
|
* |
|
37
|
|
|
* If no call is made to `Router::defaultRouteClass()`, the class used is |
|
38
|
|
|
* `Route` (`Cake\Routing\Route\Route`) |
|
39
|
|
|
* |
|
40
|
|
|
* Note that `Route` does not do any inflections on URLs which will result in |
|
41
|
|
|
* inconsistently cased URLs when used with `:plugin`, `:controller` and |
|
42
|
|
|
* `:action` markers. |
|
43
|
|
|
*/ |
|
|
|
|
|
|
44
|
|
|
/** @var \Cake\Routing\RouteBuilder $routes */ |
|
|
|
|
|
|
45
|
|
|
$routes->setRouteClass(DashedRoute::class); |
|
46
|
|
|
|
|
47
|
|
|
$routes->scope('/', function (RouteBuilder $builder) { |
|
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
$builder->prefix('admin', function($routes) { |
|
|
|
|
|
|
50
|
|
|
$routes->connect('/', ['controller' => 'Users', 'action' => 'index']); |
|
51
|
|
|
$routes->connect('/users/index', ['controller' => 'Users', 'action' => 'index']); |
|
52
|
|
|
$routes->connect('/users/login', ['controller' => 'Users', 'action' => 'login']); |
|
53
|
|
|
$routes->connect('/users/logout', ['controller' => 'Users', 'action' => 'logout']); |
|
54
|
|
|
$routes->fallbacks(DashedRoute::class); |
|
55
|
|
|
}); |
|
56
|
|
|
|
|
57
|
|
|
$builder->prefix('profile', function($routes) { |
|
|
|
|
|
|
58
|
|
|
$routes->fallbacks(DashedRoute::class); |
|
59
|
|
|
}); |
|
60
|
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
62
|
|
|
$builder->connect('/', ['controller' => 'dashboard', 'action' => 'index']); |
|
63
|
|
|
$builder->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']); |
|
64
|
|
|
$builder->fallbacks(); |
|
65
|
|
|
}); |
|
66
|
|
|
|