Skip to content

Latest commit

 

History

History
319 lines (270 loc) · 4.24 KB

ROUTES.md

File metadata and controls

319 lines (270 loc) · 4.24 KB

Alternate Snippets for Routes

[ProjectRoot]/app/Config/Routes.php

Table of Content

Routes

COMMANDS RESULTS
ci4:routes:add
$routes->add('url', 'ControllerName::index');
ci4:routes:cli
$routes->cli('migrate', 'App\Database::migrate');
ci4:routes:env
$routes->environment('development' , function($routes)
{
    $routes->add('builder','Tools\Builder::index');
});
ci4:routes:get
$routes->get('url', 'ControllerName::index');
ci4:routes:group
$routes->group('admin', function($routes)
{
    $routes->add('url', 'ControllerName::index');
});
ci4:routes:group-filter
$routes->group('api' , ['filter' => 'api-auth'], function($routes)
{
    $routes->resource('url');
});
ci4:routes:group-multiple
$routes->group('admin', function($routes)
{
    $routes->group('users', function($routes)
    {
        //Route
    });
});
ci4:routes:group-namespace
$routes->group('api' , ['namespace' => 'App\API\v1'], function($routes)
{
    //Route
});
ci4:routes:post
$routes->post('url', 'ControllerName::index');
ci4:routes:subdomain
$routes->add('from', 'to', ['subdomain' => '*']);

Placeholders

COMMANDS RESULTS
ci4:routes:placeholder
$routes->type('url/(:placeholder)', 'ControllerName::index/$1');
Type : add, get, post, put, delete
Placeholder : any, segment, num, alpha, alphanum, hash

Custom Placeholders

COMMANDS RESULTS
ci4:routes:placeholder:custom
$routes->addPlaceholder('uuid', '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}');
$routes->type('url/(:uuid)', 'ControllerName::index/$1');
Type : add, get, post, put, delete

Presenter

COMMANDS RESULTS
ci4:routes:presenter
$routes->presenter('url');

Resource

COMMANDS RESULTS
ci4:routes:resource
$routes->resource('url');