Completed
Pull Request — master (#2)
by Randall
04:53
created

DisableCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 9
c 1
b 0
f 0
dl 0
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 2
1
<?php
2
3
namespace Rawilk\LaravelModules\Commands\Other;
4
5
use Illuminate\Console\Command;
6
7
class DisableCommand extends Command
8
{
9
    /** @var string */
10
    protected $signature = 'module:disable
11
                            {module : The module to disable.}';
12
13
    /** @var string */
14
    protected $description = 'Disable the specified module.';
15
16
    public function handle(): void
17
    {
18
        /** @var \Rawilk\LaravelModules\Module $module */
19
        $module = $this->laravel['modules']->findOrFail($this->argument('module'));
20
21
        if ($module->isEnabled()) {
22
            $module->disable();
23
24
            $this->info("Module [{$module}] was disabled successfully.");
25
        } else {
26
            $this->comment("Module [{$module}] is already disabled.");
27
        }
28
    }
29
}
30