Skip to content

This pull request make the Nova's **Routing** configurable via the file **app/Config/Routing.php**

Compare
Choose a tag to compare
@dcblogdev dcblogdev released this 02 Jun 14:52
· 1691 commits to master since this release

This pull request make the Nova's Routing configurable via the file app/Config/Routing.php, which usually contains:

/**
 * Routing configuration
 */
Config::set('routing', array(
    'patterns' => array(
        //':hex'    => '[[:xdigit:]]+',
        //':uuidV4' => '\w{8}-\w{4}-\w{4}-\w{4}-\w{12}'
    ),
    'default' => array(
        'controller' => DEFAULT_CONTROLLER,
        'method'     => DEFAULT_METHOD
    )
));

In the "patterns" array entries could be added additional Routing Patterns used by the both Routers, while the "default" entry is for the ClassicRouter.

Finally, this pull request introduce a small optional feature: the Named Patterns which are practically aliases to (:any) and (:num), but permitting a more fluent definition, for example:

// Using a :ANY based Named Pattern
Router::any('blog/categories/{category}', 'App\Modules\Blog\Controllers\Blog@category');

// Using a :NUM base Named Pattern
Router::any('admin/blog/categories/{:id}', 'App\Modules\Blog\Controllers\Admin\Blog@category');