diff --git a/src/Illuminate/Foundation/Events/DiscoverEvents.php b/src/Illuminate/Foundation/Events/DiscoverEvents.php index 6a8183ef11ec..5c887c85e7cd 100644 --- a/src/Illuminate/Foundation/Events/DiscoverEvents.php +++ b/src/Illuminate/Foundation/Events/DiscoverEvents.php @@ -65,7 +65,7 @@ protected static function getListenerEvents($listeners, $basePath) */ protected static function classFromFile(SplFileInfo $file, $basePath) { - $class = trim(Str::replaceLast($basePath, '', $file->getRealPath()), DIRECTORY_SEPARATOR); + $class = trim(Str::replaceFirst($basePath, '', $file->getRealPath()), DIRECTORY_SEPARATOR); return str_replace( [DIRECTORY_SEPARATOR, 'App\\'],