diff --git a/src/Barryvdh/LaravelIdeHelper/GeneratorCommand.php b/src/Barryvdh/LaravelIdeHelper/GeneratorCommand.php index ba76aba..0954948 100755 --- a/src/Barryvdh/LaravelIdeHelper/GeneratorCommand.php +++ b/src/Barryvdh/LaravelIdeHelper/GeneratorCommand.php @@ -193,23 +193,25 @@ class GeneratorCommand extends Command { } } - - foreach ($output as $ns => $body){ - if ($ns == '__root') $ns = ''; - $outputString .= "namespace $ns{\n"; - $outputString .= $body; - $outputString .= "}\n\n"; - } - + //Include the helper file, if requested if(!empty($this->helpers)){ foreach($this->helpers as $helper){ if (file_exists($helper)){ - $outputString .= str_replace(array(''), '', \File::get($helper)); + $output['__root'] .= str_replace(array(''), '', \File::get($helper)); } } } + foreach ($output as $ns => $body){ + if ($ns == '__root'){ + $ns = ''; + } + $outputString .= "namespace $ns{\n"; + $outputString .= $body; + $outputString .= "}\n\n"; + } + return $outputString; }