mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Add ignore option
To ignore models, use the --ignore (-I) argument: php artisan ide-helper:models --ignore="Admin\Model" php artisan ide-helper:models -I Post,User Fixes #35
This commit is contained in:
@@ -58,6 +58,7 @@ class ModelsCommand extends Command {
|
||||
$this->write = $this->option('write');
|
||||
$this->dir = $this->option('dir');
|
||||
$model = $this->argument('model');
|
||||
$ignore = $this->option('ignore');
|
||||
$this->reset = $this->option('reset');
|
||||
|
||||
//If filename is default and Write is not specified, ask what to do
|
||||
@@ -67,7 +68,7 @@ class ModelsCommand extends Command {
|
||||
}
|
||||
}
|
||||
|
||||
$content = $this->generateDocs($model);
|
||||
$content = $this->generateDocs($model, $ignore);
|
||||
|
||||
if(!$this->write){
|
||||
$written = \File::put($filename, $content);
|
||||
@@ -89,7 +90,6 @@ class ModelsCommand extends Command {
|
||||
{
|
||||
return array(
|
||||
array('model', InputArgument::OPTIONAL, 'Which models to include', '*'),
|
||||
array('ignore', InputArgument::OPTIONAL, 'Which models to ignore', null),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -106,10 +106,11 @@ class ModelsCommand extends Command {
|
||||
array('write', 'W', InputOption::VALUE_NONE, 'Write to Model file'),
|
||||
array('nowrite', 'N', InputOption::VALUE_NONE, 'Don\'t write to Model file'),
|
||||
array('reset', 'R', InputOption::VALUE_NONE, 'Remove the original phpdocs instead of appending'),
|
||||
array('ignore', 'I', InputOption::VALUE_OPTIONAL, 'Which models to ignore', ''),
|
||||
);
|
||||
}
|
||||
|
||||
protected function generateDocs($model){
|
||||
protected function generateDocs($model, $ignore = ''){
|
||||
|
||||
|
||||
$output = "<?php
|
||||
@@ -128,8 +129,15 @@ class ModelsCommand extends Command {
|
||||
$models = explode(',', $model);
|
||||
}
|
||||
|
||||
foreach($models as $name){
|
||||
$ignore = explode(',', $ignore);
|
||||
|
||||
foreach($models as $name){
|
||||
if(in_array($name, $ignore)){
|
||||
$this->comment("Ignoring model '$name'");
|
||||
continue;
|
||||
}else{
|
||||
$this->comment("Loading model '$name'");
|
||||
}
|
||||
$this->properties = array();
|
||||
$this->methods = array();
|
||||
if(class_exists($name)){
|
||||
|
||||
Reference in New Issue
Block a user