You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am using the nwidart/laravel-modules package and would like to create modules under two separate subdirectories, Modules/Admin and Modules/Frontend, instead of the default Modules directory. I propose adding support for custom module directories to the package while preserving all existing features of the package.
Current Behavior
Currently, the nwidart/laravel-modules package generates modules only under the Modules directory, as defined in the paths.modules setting in config/module.php. In my project, I want to organize modules into two categories:
Modules/Admin: For admin panel-related modules (e.g., UserManagement, Dashboard).
Modules/Frontend: For front-end user interface modules (e.g., Shop, Blog).
This separation would make my project more organized and modular. However, the package does not natively support multiple module directories.
Proposed Solution
I suggest extending the package to support multiple module directories through configuration and Artisan commands. For example:
Add support for additional module paths in config/module.php:
php artisan module:make-admin {name}: Creates a module under Modules/Admin.
php artisan module:make-frontend {name}: Creates a module under Modules/Frontend.
Alternatively, enhance the existing module:make command with an option to specify the target directory:
This would create the module in the specified subdirectory.
Current Workaround
To achieve this in my project, I have implemented the following temporary workaround:
Created two custom Artisan commands, MakeAdminModule and MakeFrontendModule, in app/Console/Commands. These extend Nwidart\Modules\Commands\ModuleMakeCommand and override the module path to Modules/Admin or Modules/Frontend:
Summary
Hello, I am using the nwidart/laravel-modules package and would like to create modules under two separate subdirectories, Modules/Admin and Modules/Frontend, instead of the default Modules directory. I propose adding support for custom module directories to the package while preserving all existing features of the package.
Current Behavior
Currently, the nwidart/laravel-modules package generates modules only under the Modules directory, as defined in the paths.modules setting in config/module.php. In my project, I want to organize modules into two categories:
This separation would make my project more organized and modular. However, the package does not natively support multiple module directories.
Proposed Solution
I suggest extending the package to support multiple module directories through configuration and Artisan commands. For example:
This would create the module in the specified subdirectory.
Current Workaround
To achieve this in my project, I have implemented the following temporary workaround:
Updated composer.json to include PSR-4 autoloading for the new directories:
Ensured that module service providers and other components use the correct namespaces.
While this workaround is functional, native support in the package would be more user-friendly and maintainable.
Request
Add support for multiple module directories in the package configuration.
Extend the module:make command with a --path option or introduce new commands like module:make-admin and module:make-frontend.
Ensure compatibility with existing module features (migrations, routes, views, etc.) in the new directory structure.
The text was updated successfully, but these errors were encountered: