Skip to content

Commit e69169e

Browse files
Recursive search for .php route files
1 parent 887ed17 commit e69169e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/Foundation/Providers/RouteServiceProvider.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ public function map(Router $router)
8989
$router->group(['namespace' => $this->namespace, 'as' => 'core::'], function (Router $router) {
9090
$path = app_path('Http/Routes');
9191

92-
foreach (array_merge(glob("$path/*.php"), glob("$path/*/*.php")) as $file) {
92+
$AllFileIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
93+
$PhpFileIterator = new \RegexIterator($AllFileIterator, '/^.+\.php$/i', \RecursiveRegexIterator::GET_MATCH);
94+
95+
foreach ($PhpFileIterator as $file => $object) {
9396
$class = substr($file, strlen($path));
9497
$class = str_replace('/', '\\', $class);
9598
$class = substr($class, 0, -4);

0 commit comments

Comments
 (0)