RdbAdmin Module

routes.php

Routes configuration.

Use route collector from FastRoute directly.
Example:

$Rc->addRoute($this->filterMethod('any'), '/', '\\Rdb\\System\\Core\\Controllers\\Default:index');
$Rc->addGroup('/admin', function (\FastRoute\RouteCollector $Rc) {
    $Rc->addRoute('GET', '', '\\Rdb\\Modules\\Admin\\Controllers\\Admin\\Index:index');
    $Rc->addRoute('GET', '/login', '\\Rdb\\Modules\\Admin\\Controllers\\Admin\\Login:index');
    $Rc->addGroup('/users', , function (\FastRoute\RouteCollector $Rc) {
        $Rc->addRoute('GET', '', '\\Rdb\\Modules\\Users\\Controllers\\Admin\\Users:index');
    });
});

The HTTP method must be upper case or use $this->filterMethod('any') to get methods in array ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'PATCH'].

Fore more reference, please look at FastRoute document. https://github.com/nikic/FastRoute

You can use methods from \Rdb\System\Router class directly via $this object since this file will be include into the class.
The class in handler will be automatically add Controller suffix, and the method in handler will be automatically add Action suffix.
Users:index will be UsersController class and indexAction method.

This config is working in modules.

Tags
license

http://opensource.org/licenses/MIT MIT

Table of Contents


        
On this page
  • Table Of Contents

Search results