in Cakephp tips minutes

How to Auto-Generate an Admin Section

Use the –prefix option like so:

cake bake all articles –prefix=admin

Next update your routes file (\config\routes.php) with

...
Router::prefix('admin', function ($routes) {
    Router::scope('/', function ($routes) {

    });
    $routes->fallbacks('InflectedRoute');
});

..and that’s pretty much it, now /admin/article/add  will resolve to the articles controller in the admin folder.

All that’s left is to add some authorization and you’ve got a admin section