Skip to content

Instantly share code, notes, and snippets.

@ahmedbodi ahmedbodi/routes.php Secret
Created Feb 13, 2018

Embed
What would you like to do?
Router::defaultRouteClass('DashedRoute');
Router::scope('/', function (RouteBuilder $routes) {
$routes->connect('/', ['controller' => 'Pages', 'action' => 'display', 'lang' => 'en', 'home'], ['routeClass' => 'ADmad/I18n.I18nRoute']);
$routes->connect('/:lang', ['controller' => 'Pages', 'action' => 'display', 'home'], ['routeClass' => 'ADmad/I18n.I18nRoute']);
$routes->connect('/:lang/:controller', [], ['routeClass' => 'ADmad/I18n.I18nRoute']);
$routes->connect('/:lang/:controller/:action/*', [], ['routeClass' => 'ADmad/I18n.I18nRoute']);
$routes->fallbacks(Router::defaultRouteClass());
});
Router::prefix('admin', function (RouteBuilder $routes) {
$routes->connect('/', ['controller' => 'Dashboard', 'action' => 'index'], ['routeClass' => 'ADmad/I18n.I18nRoute']);
$routes->connect('/:lang/:controller', [], ['routeClass' => 'ADmad/I18n.I18nRoute']);
$routes->connect('/:lang/:controller/:action/*', [], ['routeClass' => 'ADmad/I18n.I18nRoute']);
$routes->fallbacks(Router::defaultRouteClass());
});
Router::prefix('api', function ($routes) {
$routes->extensions(['json', 'xml']);
$routes->fallbacks(Router::defaultRouteClass());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.