| @@ 8-53 (lines=46) @@ | ||
| 5 | use Illuminate\Console\Command; |
|
| 6 | use Symfony\Component\Console\Input\InputArgument; |
|
| 7 | ||
| 8 | class ModuleDisableCommand 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 a module'; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * Execute the console command. |
|
| 26 | * |
|
| 27 | * @return mixed |
|
| 28 | */ |
|
| 29 | public function fire() |
|
| 30 | { |
|
| 31 | $slug = $this->argument('slug'); |
|
| 32 | ||
| 33 | if ($this->laravel['modules']->isEnabled($slug)) { |
|
| 34 | $this->laravel['modules']->disable($slug); |
|
| 35 | ||
| 36 | $this->info('Module was disabled successfully.'); |
|
| 37 | } else { |
|
| 38 | $this->comment('Module is already disabled.'); |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * Get the console command arguments. |
|
| 44 | * |
|
| 45 | * @return array |
|
| 46 | */ |
|
| 47 | protected function getArguments() |
|
| 48 | { |
|
| 49 | return [ |
|
| 50 | ['slug', InputArgument::REQUIRED, 'Module slug.'], |
|
| 51 | ]; |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||
| @@ 8-53 (lines=46) @@ | ||
| 5 | use Illuminate\Console\Command; |
|
| 6 | use Symfony\Component\Console\Input\InputArgument; |
|
| 7 | ||
| 8 | class ModuleEnableCommand 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 a module'; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * Execute the console command. |
|
| 26 | * |
|
| 27 | * @return mixed |
|
| 28 | */ |
|
| 29 | public function fire() |
|
| 30 | { |
|
| 31 | $slug = $this->argument('slug'); |
|
| 32 | ||
| 33 | if ($this->laravel['modules']->isDisabled($slug)) { |
|
| 34 | $this->laravel['modules']->enable($slug); |
|
| 35 | ||
| 36 | $this->info('Module was enabled successfully.'); |
|
| 37 | } else { |
|
| 38 | $this->comment('Module is already enabled.'); |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * Get the console command arguments. |
|
| 44 | * |
|
| 45 | * @return array |
|
| 46 | */ |
|
| 47 | protected function getArguments() |
|
| 48 | { |
|
| 49 | return [ |
|
| 50 | ['slug', InputArgument::REQUIRED, 'Module slug.'], |
|
| 51 | ]; |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||