From 1cbf8f996a28200e4488f13b2856f563469a9859 Mon Sep 17 00:00:00 2001 From: vetal Date: Sun, 12 May 2019 13:38:17 +0300 Subject: [PATCH] Custom app path in auto-discovery for events --- src/Illuminate/Foundation/Events/DiscoverEvents.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)) );