Skip to content

Commit

Permalink
[8.x] Allow to override discover events base path (#36515)
Browse files Browse the repository at this point in the history
* Allow to override discover events base path

* Update EventServiceProvider.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
rodrigopedra and taylorotwell authored Mar 9, 2021
1 parent 0798479 commit d9a33b1
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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->eventDiscoveryBasePath())
);
}, []);
}
Expand All @@ -135,4 +135,14 @@ protected function discoverEventsWithin()
$this->app->path('Listeners'),
];
}

/**
* Get the base path to be used during event discovery.
*
* @return string
*/
protected function eventDiscoveryBasePath()
{
return base_path();
}
}

0 comments on commit d9a33b1

Please sign in to comment.