From c3afd5f63cc8ed2870d8cef2c7edf779bf3b0163 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Fri, 18 Oct 2013 10:04:46 +0200 Subject: [PATCH] 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 --- src/Barryvdh/LaravelIdeHelper/ModelsCommand.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php b/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php index 23800ff..6063758 100644 --- a/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php +++ b/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php @@ -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 = "comment("Ignoring model '$name'"); + continue; + }else{ + $this->comment("Loading model '$name'"); + } $this->properties = array(); $this->methods = array(); if(class_exists($name)){