Traits for package authors to add internachi/modular support to their Laravel commands.
composer require internachi/modularizeAdd the Modularize trait to your package commands:
useIlluminate\Console\Command;
useInterNACHI\Modularize\Support\Modularize;
class SomeCommand extends Command
{
use Modularize;
publicfunctionhandle()
{
if ($module = $this->module()) {
// Command was called with --module, $module is a ModuleConfig class// with name, base path, namespaces, and helper methods.
}
}
}If you're using Laravel file generator commands, add the ModularizeGeneratorCommand trait:
useIlluminate\Console\GeneratorCommand;
useInterNACHI\Modularize\Support\ModularizeGeneratorCommand;
class MakeWidget extends GeneratorCommand
{
use ModularizeGeneratorCommand;
// ...
}This adds a --module option to your command. When used, generated files are placed in the module directory with correct namespacing.