diff --git a/readme.md b/readme.md index 97c2e0b..59b5f83 100644 --- a/readme.md +++ b/readme.md @@ -75,11 +75,13 @@ With the `--reset (-R)` option, the existing phpdocs are ignored, only the newly By default, models in app/models are scanned. The optional argument tells what models to use (also outside app/models). - php artisan ide-helper:models Post,User + php artisan ide-helper:models Post User You can also scan a different directory, using the --dir option (relative from the base path): - php artisan ide-helper:models --dir="app/workbench/name/package/models" + php artisan ide-helper:models --dir="app/workbench/name/package/models" --dir="app/src/Model" + +You can publish the config file (`php artisan config:publisb barryvdh/laravel-idehelper`) and set the default directories. Models can be ignored using the --ignore (-I) option diff --git a/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php b/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php index f5d367a..dd20654 100644 --- a/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php +++ b/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php @@ -63,7 +63,7 @@ class ModelsCommand extends Command { //If filename is default and Write is not specified, ask what to do if(!$this->write && $filename === $this->filename && !$this->option('nowrite')){ - if($this->confirm("Do you want to overwrite the existing model files for '$model'? Choose no to write to $filename instead? (Yes/No): ")){ + if($this->confirm("Do you want to overwrite the existing model files? Choose no to write to $filename instead? (Yes/No): ")){ $this->write = true; } } @@ -89,7 +89,7 @@ class ModelsCommand extends Command { protected function getArguments() { return array( - array('model', InputArgument::OPTIONAL, 'Which models to include', '*'), + array('model', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Which models to include', array()), ); } @@ -110,7 +110,7 @@ class ModelsCommand extends Command { ); } - protected function generateDocs($model, $ignore = ''){ + protected function generateDocs($loadModels, $ignore = ''){ $output = "loadModels(); }else{ - $models = explode(',', $model); + $models = array(); + foreach($loadModels as $model){ + $models = array_merge($models, explode(',', $model)); + } } $ignore = explode(',', $ignore);