1 | <?php |
||
2 | |||
3 | namespace Rawilk\LaravelModules\Commands\Other; |
||
4 | |||
5 | use Illuminate\Console\Command; |
||
6 | use Illuminate\Support\Str; |
||
7 | |||
8 | class UseCommand extends Command |
||
9 | { |
||
10 | /** @var string */ |
||
11 | protected $signature = 'module:use |
||
12 | {module : The name of the module to use in the cli session}'; |
||
13 | |||
14 | /** @var string */ |
||
15 | protected $description = 'Use the specified module in the cli session.'; |
||
16 | |||
17 | public function handle(): void |
||
18 | { |
||
19 | $module = Str::studly($this->argument('module')); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
20 | |||
21 | if (! $this->laravel['modules']->has($module)) { |
||
22 | $this->error("Module [{$module}] does not exist!"); |
||
23 | |||
24 | return; |
||
25 | } |
||
26 | |||
27 | $this->laravel['modules']->setUsed($module); |
||
28 | |||
29 | $this->info("Module [{$module}] is now being used in the cli session!"); |
||
30 | } |
||
31 | } |
||
32 |