Skip to content

Commit d9a33b1

Browse files
[8.x] Allow to override discover events base path (#36515)
* Allow to override discover events base path * Update EventServiceProvider.php Co-authored-by: Taylor Otwell <[email protected]>
1 parent 0798479 commit d9a33b1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function discoverEvents()
119119
->reduce(function ($discovered, $directory) {
120120
return array_merge_recursive(
121121
$discovered,
122-
DiscoverEvents::within($directory, base_path())
122+
DiscoverEvents::within($directory, $this->eventDiscoveryBasePath())
123123
);
124124
}, []);
125125
}
@@ -135,4 +135,14 @@ protected function discoverEventsWithin()
135135
$this->app->path('Listeners'),
136136
];
137137
}
138+
139+
/**
140+
* Get the base path to be used during event discovery.
141+
*
142+
* @return string
143+
*/
144+
protected function eventDiscoveryBasePath()
145+
{
146+
return base_path();
147+
}
138148
}

0 commit comments

Comments
 (0)