Skip to content

Commit

Permalink
[5.x] Register App extensions also for Classes in Subfolders (#11046)
Browse files Browse the repository at this point in the history
Co-authored-by: Duncan McClean <[email protected]>
  • Loading branch information
benatoff and duncanmcclean authored Dec 5, 2024
1 parent 313b2a6 commit a345e00
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Providers/ExtensionServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit a345e00

Please sign in to comment.