| Conditions | 3 |
| Paths | 3 |
| Total Lines | 33 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | public function handle() |
||
| 28 | { |
||
| 29 | $this->module = Module::find($this->argument('module')); |
||
| 30 | |||
| 31 | // Verify Module exists |
||
| 32 | if(!$this->module) |
||
| 33 | { |
||
| 34 | $this->error('Unable to find module'); |
||
| 35 | return 1; |
||
| 36 | } |
||
| 37 | |||
| 38 | // Verify module has config file |
||
| 39 | $this->line('Activating Module '.$this->module); |
||
| 40 | if(!$this->checkForConfig()) |
||
| 41 | { |
||
| 42 | $this->error('Config file is missing'); |
||
| 43 | return 1; |
||
| 44 | } |
||
| 45 | |||
| 46 | // Enable the module |
||
| 47 | Artisan::call('module:enable '.$this->module->getStudlyName()); |
||
| 48 | |||
| 49 | // Run any migrations |
||
| 50 | $this->line('Setting up database'); |
||
| 51 | Artisan::call('migrate'); |
||
| 52 | |||
| 53 | // Combine the new Javascript files |
||
| 54 | $this->line('Creating Javascript files (this may take some time)'); |
||
| 55 | shell_exec('cd '.base_path().DIRECTORY_SEPARATOR.' && npm run production'); |
||
| 56 | |||
| 57 | $this->info('Module has been activated'); |
||
| 58 | |||
| 59 | return Command::SUCCESS; |
||
| 60 | } |
||
| 67 |