diff --git a/src/Illuminate/Foundation/Events/DiscoverEvents.php b/src/Illuminate/Foundation/Events/DiscoverEvents.php index 5c887c85e7cd..e5098fae3061 100644 --- a/src/Illuminate/Foundation/Events/DiscoverEvents.php +++ b/src/Illuminate/Foundation/Events/DiscoverEvents.php @@ -66,9 +66,10 @@ protected static function getListenerEvents($listeners, $basePath) protected static function classFromFile(SplFileInfo $file, $basePath) { $class = trim(Str::replaceFirst($basePath, '', $file->getRealPath()), DIRECTORY_SEPARATOR); + $appPath = ucfirst(basename(app()->path())); return str_replace( - [DIRECTORY_SEPARATOR, 'App\\'], + [DIRECTORY_SEPARATOR, "{$appPath}\\"], ['\\', app()->getNamespace()], ucfirst(Str::replaceLast('.php', '', $class)) );