From cca1b5896e14ec0ff8d65f3cffec727f568215f2 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Thu, 30 May 2013 21:26:02 +0200 Subject: [PATCH] Only allow relative path --- src/Barryvdh/LaravelIdeHelper/ModelsCommand.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php b/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php index 9817b43..80a6e4e 100644 --- a/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php +++ b/src/Barryvdh/LaravelIdeHelper/ModelsCommand.php @@ -93,7 +93,7 @@ class ModelsCommand extends Command { { return array( array('filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the helper file', '_ide_helper_models.php'), - array('dir', 'D', InputOption::VALUE_OPTIONAL, 'The model dir', app_path().'/models'), + array('dir', 'D', InputOption::VALUE_OPTIONAL, 'The model dir','models'), array('write', 'W', InputOption::VALUE_NONE, 'Write to Model file'), ); } @@ -141,13 +141,12 @@ class ModelsCommand extends Command { protected function loadModels(){ - $dir = $this->dir; - if(!file_exists($dir)){ - $dir = base_path().'/'.$dir; - } + $dir = base_path().'/'.$this->dir; $models = array(); - foreach(ClassMapGenerator::createMap($dir) as $model=> $path){ - $models[] = $model; + if(file_exists($dir)){ + foreach(ClassMapGenerator::createMap($dir) as $model=> $path){ + $models[] = $model; + } } return $models; }