Welcome Guest, Not a member yet? Register   Sign In
help with setting up routes rules
#1

Hi,

I am having trouble in setting up the routing rules. In the app/Config/Routes.php, all HTTP verb use would result with 404, but get. Here's how I am setting up the rules which is in trouble.

PHP Code:
$routes->group('admin', ['namespace' => 'App\Controllers\Admin'], function ($routes) {
    
$routes->add('/''User::index');
    
    
$routes->group('page', ['namespace' => 'App\Controllers\Admin'], function ($routes) {
        
$routes->add('/''Page::index');
    });
}); 

But this works.

PHP Code:
$routes->group('admin', ['namespace' => 'App\Controllers\Admin'], function ($routes) {
    
$routes->get('/''User::index');
    
    
$routes->group('page', ['namespace' => 'App\Controllers\Admin'], function ($routes) {
        
$routes->get('/''Page::index');
    });
}); 

Thank you for your time in advance.

Wing
Reply
#2

I tried it, but both are working in my case.
any other information you could provide?


I also test with:
PHP Code:
$routes->group('admin', function ($routes) {
    $routes->add('/''Admin\Test::index');
    $routes->group('page', function ($routes) {
        $routes->add('/''Admin\Test::index');
    });
});

$routes->group('admin', function ($routes) {
    $routes->get('/''Admin\Test::index');
    $routes->group('page', function ($routes) {
        $routes->get('/''Admin\Test::index');
    });
}); 
But all working just fine.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB