Skip to content

Instantly share code, notes, and snippets.

@subhanahmed047
Last active June 12, 2016 15:35
Show Gist options
  • Save subhanahmed047/028726abf3ca6c77944d95f50969c4fb to your computer and use it in GitHub Desktop.
Save subhanahmed047/028726abf3ca6c77944d95f50969c4fb to your computer and use it in GitHub Desktop.
Some actions in admin prefix some in /
Router::scope('/', function ($routes) {
$routes->plugin(
'IncUsers',
['path' => '/'],
function (RouteBuilder $routes) {
$routes->connect('/login/', ['controller' => 'Users', 'action' => 'login']);
$routes->connect('/register/', ['controller' => 'Users', 'action' => 'add']);
$routes->fallbacks('DashedRoute');
});
});
Router::prefix('admin', function ($routes) {
$routes->plugin(
'IncUsers',
['path' => '/users'],
function (RouteBuilder $routes) {
$routes->connect('/', ['controller' => 'Users', 'action' => 'index']);
$routes->connect('/logout/', ['controller' => 'Users', 'action' => 'logout']);
$routes->connect('/profile/:id', ['controller' => 'Users', 'action' => 'view'],
['id' => '\d+', 'pass' => ['id']]);
$routes->fallbacks('DashedRoute');
}
);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment