Set a default module for commands
Store a default module with module:use so you do not have to pass the module name to every generator command.
Set the default module
Section titled “Set the default module”php artisan module:use BlogThis writes the module name to storage/app/modules/modules.used. Every subsequent generator command in any terminal uses Blog until you clear it.
Generate without the module argument
Section titled “Generate without the module argument”Omit the module argument on any generator command to target the stored module:
php artisan module:make-controller PostControllerThis creates Modules/Blog/app/Http/Controllers/PostController.php. Passing an explicit module name overrides the default (for example php artisan module:make-controller PostController Shop writes into Shop).
Clear the default module
Section titled “Clear the default module”Run module:unuse to clear the stored module (any module name or --all flag passed to it is ignored):
php artisan module:unuseForget Using Blog Module ........................................ DONEIf no module is currently set, module:unuse prints No module is in use. and exits with status 0. When a module was in use, it fires modules.blog.unused.
Check the result
Section titled “Check the result”After module:unuse, running a generator without a module name fails with exit status 1:
php artisan module:make-controller PostControllerERROR No module given, and no module is set with module:use. Pass the module name, or run php artisan module:use <module> first.