@@ 8-53 (lines=46) @@ | ||
5 | use Illuminate\Console\Command as ComponentCommand; |
|
6 | use Symfony\Component\Console\Input\InputArgument; |
|
7 | ||
8 | class DisableCommand extends ComponentCommand |
|
9 | { |
|
10 | /** |
|
11 | * The console command name. |
|
12 | * |
|
13 | * @var string |
|
14 | */ |
|
15 | protected $name = 'component:disable'; |
|
16 | ||
17 | /** |
|
18 | * The console command description. |
|
19 | * |
|
20 | * @var string |
|
21 | */ |
|
22 | protected $description = 'Disable the specified component.'; |
|
23 | ||
24 | /** |
|
25 | * Execute the console command. |
|
26 | * |
|
27 | * @return mixed |
|
28 | */ |
|
29 | public function fire() |
|
30 | { |
|
31 | $component = $this->laravel['components']->findOrFail($this->argument('component')); |
|
32 | ||
33 | if ($component->enabled()) { |
|
34 | $component->disable(); |
|
35 | ||
36 | $this->info("Component [{$component}] disabled successful."); |
|
37 | } else { |
|
38 | $this->comment("Component [{$component}] 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 [ |
|
50 | ['component', InputArgument::REQUIRED, 'Component name.'], |
|
51 | ]; |
|
52 | } |
|
53 | } |
|
54 |
@@ 8-53 (lines=46) @@ | ||
5 | use Illuminate\Console\Command as ComponentCommand; |
|
6 | use Symfony\Component\Console\Input\InputArgument; |
|
7 | ||
8 | class EnableCommand extends ComponentCommand |
|
9 | { |
|
10 | /** |
|
11 | * The console command name. |
|
12 | * |
|
13 | * @var string |
|
14 | */ |
|
15 | protected $name = 'component:enable'; |
|
16 | ||
17 | /** |
|
18 | * The console command description. |
|
19 | * |
|
20 | * @var string |
|
21 | */ |
|
22 | protected $description = 'Enable the specified component.'; |
|
23 | ||
24 | /** |
|
25 | * Execute the console command. |
|
26 | * |
|
27 | * @return mixed |
|
28 | */ |
|
29 | public function fire() |
|
30 | { |
|
31 | $component = $this->laravel['components']->findOrFail($this->argument('component')); |
|
32 | ||
33 | if ($component->disabled()) { |
|
34 | $component->enable(); |
|
35 | ||
36 | $this->info("Component [{$component}] enabled successful."); |
|
37 | } else { |
|
38 | $this->comment("Component [{$component}] 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 [ |
|
50 | ['component', InputArgument::REQUIRED, 'Component name.'], |
|
51 | ]; |
|
52 | } |
|
53 | } |
|
54 |