diff --git a/src/Providers/ExtensionServiceProvider.php b/src/Providers/ExtensionServiceProvider.php index d70ffa149f..2a32a74bc2 100644 --- a/src/Providers/ExtensionServiceProvider.php +++ b/src/Providers/ExtensionServiceProvider.php @@ -335,9 +335,12 @@ protected function registerAppExtensions($folder, $requiredClass) return; } - foreach ($this->app['files']->files($path) as $file) { + foreach ($this->app['files']->allFiles($path) as $file) { + $relativePathOfFolder = str_replace(app_path('/'), '', $file->getPath()); + $namespace = str_replace('/', '\\', $relativePathOfFolder); $class = $file->getBasename('.php'); - $fqcn = $this->app->getNamespace()."{$folder}\\{$class}"; + + $fqcn = $this->app->getNamespace()."{$namespace}\\{$class}"; if (is_subclass_of($fqcn, $requiredClass)) { $fqcn::register(); }