| 1: | <?php |
| 2: | |
| 3: | namespace Aurora\System\Console\Commands; |
| 4: | |
| 5: | use Aurora\System\Api; |
| 6: | use Aurora\System\Models\Hook; |
| 7: | use Illuminate\Container\Container; |
| 8: | use Illuminate\Support\Facades\App; |
| 9: | use Symfony\Component\Console\Input\InputInterface; |
| 10: | use Symfony\Component\Console\Input\InputOption; |
| 11: | use Symfony\Component\Console\Output\OutputInterface; |
| 12: | |
| 13: | class ModelsCommand extends \Barryvdh\LaravelIdeHelper\Console\ModelsCommand |
| 14: | { |
| 15: | public function __construct(Container $appContainer) |
| 16: | { |
| 17: | $appContainer['config']->set('ide-helper.model_hooks', [Hook::class]); |
| 18: | $this->setLaravel($appContainer); |
| 19: | |
| 20: | parent::__construct($appContainer['filesystem']); |
| 21: | } |
| 22: | |
| 23: | protected function execute(InputInterface $input, OutputInterface $output): int |
| 24: | { |
| 25: | if ($this->option('all-models')) { |
| 26: | $aModules = Api::GetModuleManager()->GetModulesPaths(); |
| 27: | $aModulesModelsPaths = array_map(function ($sModule, $sPath) { |
| 28: | return $sPath . $sModule . DIRECTORY_SEPARATOR . 'Models'; |
| 29: | }, array_keys($aModules), $aModules); |
| 30: | App::make('config')->set('ide-helper.model_locations', [$aModulesModelsPaths]); |
| 31: | } |
| 32: | |
| 33: | return parent::execute($input, $output); |
| 34: | } |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | |
| 40: | |
| 41: | protected function getOptions() |
| 42: | { |
| 43: | $options = parent::getOptions(); |
| 44: | $options[] = ['all-models', 'A', InputOption::VALUE_NONE, 'Find and generate phpdocs for all models']; |
| 45: | |
| 46: | return $options; |
| 47: | } |
| 48: | } |
| 49: | |