PATH:
home
/
lab2454c
/
costbloc.com
/
vendor
/
nwidart
/
laravel-modules
/
src
/
Commands
<?php namespace Nwidart\Modules\Commands; use Illuminate\Console\Command; use Nwidart\Modules\Contracts\ActivatorInterface; use Nwidart\Modules\Generators\ModuleGenerator; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; class ModuleMakeCommand extends Command { /** * The console command name. * * @var string */ protected $name = 'module:make'; /** * The console command description. * * @var string */ protected $description = 'Create a new module.'; /** * Execute the console command. */ public function handle() : int { $names = $this->argument('name'); $success = true; foreach ($names as $name) { $code = with(new ModuleGenerator($name)) ->setFilesystem($this->laravel['files']) ->setModule($this->laravel['modules']) ->setConfig($this->laravel['config']) ->setActivator($this->laravel[ActivatorInterface::class]) ->setConsole($this) ->setForce($this->option('force')) ->setType($this->getModuleType()) ->setActive(!$this->option('disabled')) ->generate(); if ($code === E_ERROR) { $success = false; } } return $success ? 0 : E_ERROR; } /** * Get the console command arguments. * * @return array */ protected function getArguments() { return [ ['name', InputArgument::IS_ARRAY, 'The names of modules will be created.'], ]; } protected function getOptions() { return [ ['plain', 'p', InputOption::VALUE_NONE, 'Generate a plain module (without some resources).'], ['api', null, InputOption::VALUE_NONE, 'Generate an api module.'], ['web', null, InputOption::VALUE_NONE, 'Generate a web module.'], ['disabled', 'd', InputOption::VALUE_NONE, 'Do not enable the module at creation.'], ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when the module already exists.'], ]; } /** * Get module type . * * @return string */ private function getModuleType() { $isPlain = $this->option('plain'); $isApi = $this->option('api'); if ($isPlain && $isApi) { return 'web'; } if ($isPlain) { return 'plain'; } elseif ($isApi) { return 'api'; } else { return 'web'; } } }
[-] SeedCommand.php
[edit]
[-] DisableCommand.php
[edit]
[-] MigrateResetCommand.php
[edit]
[-] SeedMakeCommand.php
[edit]
[-] MigrateRollbackCommand.php
[edit]
[-] MailMakeCommand.php
[edit]
[-] RouteProviderMakeCommand.php
[edit]
[-] LaravelModulesV6Migrator.php
[edit]
[+]
..
[-] ListCommand.php
[edit]
[-] CommandMakeCommand.php
[edit]
[-] NotificationMakeCommand.php
[edit]
[-] FactoryMakeCommand.php
[edit]
[-] ComponentViewMakeCommand.php
[edit]
[-] SetupCommand.php
[edit]
[-] ResourceMakeCommand.php
[edit]
[-] MigrateRefreshCommand.php
[edit]
[-] PublishTranslationCommand.php
[edit]
[-] MigrateStatusCommand.php
[edit]
[-] ModuleMakeCommand.php
[edit]
[-] ComponentClassMakeCommand.php
[edit]
[-] UpdateCommand.php
[edit]
[-] UseCommand.php
[edit]
[-] PublishMigrationCommand.php
[edit]
[-] RequestMakeCommand.php
[edit]
[-] MigrateFreshCommand.php
[edit]
[-] MigrationMakeCommand.php
[edit]
[-] PublishCommand.php
[edit]
[-] MigrateCommand.php
[edit]
[-] TestMakeCommand.php
[edit]
[-] ModuleDeleteCommand.php
[edit]
[-] RuleMakeCommand.php
[edit]
[-] PolicyMakeCommand.php
[edit]
[-] EnableCommand.php
[edit]
[-] ListenerMakeCommand.php
[edit]
[-] MiddlewareMakeCommand.php
[edit]
[-] InstallCommand.php
[edit]
[-] DumpCommand.php
[edit]
[-] PublishConfigurationCommand.php
[edit]
[-] ModelMakeCommand.php
[edit]
[-] ProviderMakeCommand.php
[edit]
[-] EventMakeCommand.php
[edit]
[-] JobMakeCommand.php
[edit]
[-] GeneratorCommand.php
[edit]
[+]
stubs
[-] ControllerMakeCommand.php
[edit]
[-] UnUseCommand.php
[edit]