Hi everyone.
I’m using Cakephp 3 y I created a plugin named Intranet using bake:
bin/cake bake plugin Intranet
This structure was created:
project/plugins/Intranet
After that I created a Products controller:
bin/cake bake controller --plugin Intranet Products
In config/bootstrap.php file of my project I added:
Plugin::load('Intranet', ['bootstrap' => false, 'routes' => true]);
And in config/routes.php:
Plugin::routes();
In project/plugins/Intranet/config/routes.php file I had the next:
Router::plugin(
'Intranet',
['path' => '/intranet'],
function (RouteBuilder $routes) {
$routes->fallbacks(DashedRoute::class);
}
);
And in project/plugins/Intranet/composer.json:
"autoload": {
"psr-4": {
"Intranet\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Intranet\\Test\\": "tests",
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests"
}
}
But when I access to http://site/intranet/products/index I get this error:
A route matching “array ( ‘controller’ => ‘users’, ‘action’ => ‘login’, ‘prefix’ => ‘admin’, ‘_mobile’ => false, ‘preview’ => false, ‘plugin’ => ‘Intranet’, ‘_ext’ => NULL, )” could not be found.
Can someone help me to identify the error? I tried other ways like write:
Plugin::load('Intranet', ['autoload' => true, 'bootstrap' => false, 'routes' => true]);
Also I tried to write the route in routes.php project file and execute the commands:
composer update y composer dumpautoload
without results.
Regards and thanks. Sorry, my English is very bad.