2
I’m having a hard time and I couldn’t fix it. I have a settings file in this file I have an array and several arrays within it and one of these is my route array. What I need to do is include a file within this route array because I have many routes and I want to separate them by file for easy maintenance later. well, what I got is this:
Routes.php
return array( 'dependencias' => [ // array de dependências ], 'routes' => [ // array de rotas que eu quero inserir ] );
php routes.
[
'name' => 'home',
'path' => '/',
'middleware' => Site\Action\HomePageAction::class,
'allowed_methods' => ['GET'],
],
what I need is to include the.php routes file inside the Routes array. Has anyone done this or knows how to do it?
Grateful
Oops. Thank you for answering... right.. for a route actually worked, but now my problem is that I need to put several routes inside a file, for example: in this file routes, will be the login routes so will have the login route, auth, admin and logout.. how do I return an array of each route? I tested by placing each route between [ ] but it didn’t work :(
– Alexandro Zaleski
Oops, see if the change I made addresses your doubt.
– William Novak
I would have done it, but it didn’t work.. because you can only have an array inside the route and then the arrays with the routes and so there is a more array before the array with the routes. I don’t know what to do..
– Alexandro Zaleski
I managed to do as I wanted using the array_merge(), it joins several arrays within one.. Thank you all
– Alexandro Zaleski