From 19f5ffbad7d4c1aac85b24294578476c008c24e4 Mon Sep 17 00:00:00 2001 From: Rodrigo Pedra Brum Date: Tue, 9 Mar 2021 02:28:06 -0300 Subject: [PATCH 1/2] Allow to override discover events base path --- .../Foundation/Support/Providers/EventServiceProvider.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php b/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php index 0573563cf5ac..1cbc50debef2 100644 --- a/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php +++ b/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php @@ -119,7 +119,7 @@ public function discoverEvents() ->reduce(function ($discovered, $directory) { return array_merge_recursive( $discovered, - DiscoverEvents::within($directory, base_path()) + DiscoverEvents::within($directory, $this->discoverEventsBasePath()) ); }, []); } @@ -135,4 +135,9 @@ protected function discoverEventsWithin() $this->app->path('Listeners'), ]; } + + protected function discoverEventsBasePath() + { + return base_path(); + } } From c317d16839bb0790e82ff7a61967e8d124c45075 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 9 Mar 2021 07:28:32 -0600 Subject: [PATCH 2/2] Update EventServiceProvider.php --- .../Support/Providers/EventServiceProvider.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php b/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php index 1cbc50debef2..70ea3086efe9 100644 --- a/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php +++ b/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php @@ -119,7 +119,7 @@ public function discoverEvents() ->reduce(function ($discovered, $directory) { return array_merge_recursive( $discovered, - DiscoverEvents::within($directory, $this->discoverEventsBasePath()) + DiscoverEvents::within($directory, $this->eventDiscoveryBasePath()) ); }, []); } @@ -136,7 +136,12 @@ protected function discoverEventsWithin() ]; } - protected function discoverEventsBasePath() + /** + * Get the base path to be used during event discovery. + * + * @return string + */ + protected function eventDiscoveryBasePath() { return base_path(); }