| @@ 8-53 (lines=46) @@ | ||
| 5 | use Illuminate\Console\Command; |
|
| 6 | use Symfony\Component\Console\Input\InputArgument; |
|
| 7 | ||
| 8 | class DisableCommand extends Command |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * The console command name. |
|
| 12 | * |
|
| 13 | * @var string |
|
| 14 | */ |
|
| 15 | protected $name = 'module:disable'; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * The console command description. |
|
| 19 | * |
|
| 20 | * @var string |
|
| 21 | */ |
|
| 22 | protected $description = 'Disable the specified module.'; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * Execute the console command. |
|
| 26 | * |
|
| 27 | * @return mixed |
|
| 28 | */ |
|
| 29 | public function fire() |
|
| 30 | { |
|
| 31 | $module = $this->laravel['modules']->findOrFail($this->argument('module')); |
|
| 32 | ||
| 33 | if ($module->enabled()) { |
|
| 34 | $module->disable(); |
|
| 35 | ||
| 36 | $this->info("Module [{$module}] disabled successful."); |
|
| 37 | } else { |
|
| 38 | $this->comment("Module [{$module}] has already disabled."); |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * Get the console command arguments. |
|
| 44 | * |
|
| 45 | * @return array |
|
| 46 | */ |
|
| 47 | protected function getArguments() |
|
| 48 | { |
|
| 49 | return array( |
|
| 50 | array('module', InputArgument::REQUIRED, 'Module name.'), |
|
| 51 | ); |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| @@ 8-53 (lines=46) @@ | ||
| 5 | use Illuminate\Console\Command; |
|
| 6 | use Symfony\Component\Console\Input\InputArgument; |
|
| 7 | ||
| 8 | class EnableCommand extends Command |
|
| 9 | { |
|
| 10 | /** |
|
| 11 | * The console command name. |
|
| 12 | * |
|
| 13 | * @var string |
|
| 14 | */ |
|
| 15 | protected $name = 'module:enable'; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * The console command description. |
|
| 19 | * |
|
| 20 | * @var string |
|
| 21 | */ |
|
| 22 | protected $description = 'Enable the specified module.'; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * Execute the console command. |
|
| 26 | * |
|
| 27 | * @return mixed |
|
| 28 | */ |
|
| 29 | public function fire() |
|
| 30 | { |
|
| 31 | $module = $this->laravel['modules']->findOrFail($this->argument('module')); |
|
| 32 | ||
| 33 | if ($module->disabled()) { |
|
| 34 | $module->enable(); |
|
| 35 | ||
| 36 | $this->info("Module [{$module}] enabled successful."); |
|
| 37 | } else { |
|
| 38 | $this->comment("Module [{$module}] has already enabled."); |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * Get the console command arguments. |
|
| 44 | * |
|
| 45 | * @return array |
|
| 46 | */ |
|
| 47 | protected function getArguments() |
|
| 48 | { |
|
| 49 | return array( |
|
| 50 | array('module', InputArgument::REQUIRED, 'Module name.'), |
|
| 51 | ); |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||