Skip to content

Commit

Permalink
Let Kernel load many paths (#20251)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmichot authored and taylorotwell committed Jul 25, 2017
1 parent 71f30fe commit feb976e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Illuminate/Foundation/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,24 @@ public function command($signature, Closure $callback)
/**
* Register all of the commands in the given directory.
*
* @param string $path
* @param array|string $paths
* @return void
*/
protected function load($path)
protected function load($paths)
{
if (! is_dir($path)) {
$paths = array_unique(is_array($paths) ? $paths : (array) $paths);

$paths = array_filter($paths, function ($path) {
return is_dir($path);
});

if (empty($paths)) {
return;
}

$namespace = $this->app->getNamespace();

foreach ((new Finder)->in($path)->files() as $command) {
foreach ((new Finder)->in($paths)->files() as $command) {
$command = $namespace.str_replace(
['/', '.php'],
['\\', ''],
Expand Down

0 comments on commit feb976e

Please sign in to comment.