Skip to content

Commit

Permalink
Recursive search for .php route files
Browse files Browse the repository at this point in the history
  • Loading branch information
KoenDeCausmaecker-TomTom committed Sep 22, 2017
1 parent 887ed17 commit e69169e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/Foundation/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ public function map(Router $router)
$router->group(['namespace' => $this->namespace, 'as' => 'core::'], function (Router $router) {
$path = app_path('Http/Routes');

foreach (array_merge(glob("$path/*.php"), glob("$path/*/*.php")) as $file) {
$AllFileIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
$PhpFileIterator = new \RegexIterator($AllFileIterator, '/^.+\.php$/i', \RecursiveRegexIterator::GET_MATCH);

foreach ($PhpFileIterator as $file => $object) {
$class = substr($file, strlen($path));
$class = str_replace('/', '\\', $class);
$class = substr($class, 0, -4);
Expand Down

0 comments on commit e69169e

Please sign in to comment.