Open moisish opened 2 years ago
Hello, Moisis. Yes, the custom modules structure support is weak. We are working on it. Routing declared that dynamic way isn't possible to support.
If you want to have route completion for route files declared such way(I hope these files at least under the routes
directory) you can read here: https://laravel-idea.com/docs/routing#route-files-recognition
Hey @adelf,
Thanks for your reply. Let me know if there is a way to help with the modules structure.
A few more observations:
Views autocompletion does not work when used loadViewsFrom
on a serviceprovider
This is my current implementation
$this->loadViewsFrom($module->getBasePath('resources'), $module->getViewsNamespace());
I tried changing my implementation of $module->getBasePath()
to not return the base_path so I can do
$this->loadViewsFrom(base_path($module->getBasePath('resources')), $module->getViewsNamespace());
but still no luck
The routes autocompletion is not working because i am using a mixin and not because of the modules structure. If I removed the mixin the autocompletion on routes work without the phpDocs as per your documentation.
I changed temporarily the
Route::engagements(function () {});
to
Route::middleware(['web', 'auth'])
->prefix('engagements')
->group(function () {
});
and I can get suggestion on routes
config('api.app.version')
I don't run PHP code inside PhpStorm. So, it's very hard to find these paths. I can. for example, register this view call:
$this->loadViewsFrom(base_path('Modules/Module1/resources'), 'module1');
Because it's static. But I don't understand what $module
is. So, can't support this. The same is about config files and routes. I'll add a possibility to register everything in the ide.json
file soon.
Ok, unfortunately I can't "hardcode" the loadViewsFrom for all modules since I have a system in place where it loops through all the active modules and runs it.
Config files is unrelated to my modules structure. On the laravel root config directory I have subdirectories with more config files in them.
Routes Mixin again is unrelated to my modules structure. On the RouteServiceProvider boot method I have
Route::mixin(new RoutesMixin(), false);
Feature Description
Hello,
First of all, thank you for the great plugin.
On my project I have implemented my own modules structure which is similar to nwidart/laravel-modules but I have multiple levels under the \Modules namespace.
At the moment I am using the Simple Directory modules but that's not working very well for my case.
My modules structure can be like bellow:
Is there anything I can do about?
I don't get any routes autocompletion for the modules and I am not sure if that's the problem or not.
The routes of the modules are included by a ServiceProvider