Skip to content

Commit 346d352

Browse files
zanoziktaylorotwell
authored andcommitted
Update ListenerMakeCommand.php (#19660)
* Update ListenerMakeCommand.php Allow to make listeners for the events outside of App or Illuminate namespaces * Update ListenerMakeCommand.php Pass all prefixes to `Str::startWith()` in anonymous array. instead of calling it 3 times (even more useful if more prefixes will be added later on). * Update ListenerMakeCommand.php Typo :(
1 parent cfc5264 commit 346d352

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Illuminate/Foundation/Console/ListenerMakeCommand.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ protected function buildClass($name)
5353
{
5454
$event = $this->option('event');
5555

56-
if (! Str::startsWith($event, $this->laravel->getNamespace()) &&
57-
! Str::startsWith($event, 'Illuminate')) {
56+
if (! Str::startsWith($event, [
57+
$this->laravel->getNamespace(),
58+
'Illuminate',
59+
'\\',
60+
])) {
5861
$event = $this->laravel->getNamespace().'Events\\'.$event;
5962
}
6063

0 commit comments

Comments
 (0)