Reputation: 3228
By the docs, it is stated that routes should be placed in web/routes.php
. I wonder, can I organize the routes by class or modules the way I wanted?
Upvotes: 2
Views: 431
Reputation: 2543
Here is how I did it in my lumen 5.4 app. For each module/controller class I have a different Route.php
file under App\Http\Routes\
. And in my App\Http\routes.php
, I load them as
$app->group(
[],
function () use ($app) {
foreach (glob(__DIR__ . '/Routes/*.php') as $filename) {
include $filename;
}
}
);
Upvotes: 1