Merging laravel dingo with laravel-modules and caching config

306 views Asked by At

Here is the problem.

I started a dingo project and am using laravel-modules in it. Every module has its own routing files. Using the project in development environment, everything works fine.

But when I run php artisan config:cache, when a request comes to laravel, it return the response The version given was unknown or has no registered routes. As I see, the problem is dingo just check the default api.php and web.php files to find the route. But module routes are not stored in that files. I store them in Modules/module_name/route/api.php file (as laravel-modules suggested).

Any suggestion would be welcome.

1

There are 1 answers

0
IgorHerson On

change api file of module with version param in group session like this:

$api = app('Dingo\Api\Routing\Router');
    
$api->group(['version' => 'v1'], function ($api) {
    ...
});