Closed apps4u closed 3 years ago
Same Issue
Does The issue still persist? I really wanted to apply modular approach but using api
Yes I can run route:list command and it will show the routes, but they won't work I have to copy the routes into the project's main routes file for them to work which is not good as the whole point of using modules was to package everything. Its not just this modules API routes and its all modules routes they only work if I copy them to the projects main routes files yet the route list shows that they are registered
Please share your code. There is no way this package exists with a bug like this. I use api routes all the time without any issues.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I have the same issue here. Ex for the route /api/test ... if I move this line:
Route::get('/test', [TestController::class, 'index']);
from api.php (module) to api.php (main) it works
If the route api (from above) is in the api.php (module) it does not hit the TestController.
Having the same issue, anyone who's managed to find a workaround?
no. I am still searching for a solution
Hello , I think that help you https://stackoverflow.com/questions/58243133/laravel-modules-vuejs-routes-are-being-overwritten/58244647#58244647
same, i can't hit the api.php
routes for my API module. I'm on Laravel 10
I just faced the same issue, i am using modules system for my Vue app, and the APIs don't work from the modules. And I find out that because of the wildcard entry routes, the issue is causing.
So I followed what @hamzakifani suggested and used ->where('any', '^(?!api).*$'); at the end of the wildcard routes.
Now it's fixed .
Hi, I have a Laravel 7 Application with 3 modules, I can enable all 3 and I can list routes and all my module routes show up, But for whatever reason, I can not run them when I call the routes and set breakpoints they never get to the controller action at all, I've tried just about everything I can think of I have tried test route with closure and they don't work.
This is my Route Service Provider. I
This is my Api.php route sorry about the mess I've been trying everything to get it to work. I left the commented-out routes to show you what I've tried.
artisan route list shows the route with or with optimize, I can see that my module is loaded everything, When I step through the code from setting a breakpoint in API routes file I go through the normal Laravel route mapping and that looks fine it maps to __invoke or If I try with a method with @method, etc. But If I set a breakpoint into the Controller then I will never get hit, Yet stepping through the code I can see the Laravel-modules file finder finds the controller file that the only time the code gets near the controller and if I continue to step through the code I get to Laravel calling render and returning some HTML which is what would happen if I did not have a route defined.
Any help would be great if it turned out to be a bug in Laravel-Module I would even be happy to fix the bug and PR. I've spent my whole Saturday stepping through the code from line 1 in index.php till Laravel render is called and I can not seem to work out what's going on I have no exceptions of any kind.