Skip to content

Commit

Permalink
Update ListenerMakeCommand.php (#19660)
Browse files Browse the repository at this point in the history
* 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 :(
  • Loading branch information
zanozik authored and taylorotwell committed Jun 19, 2017
1 parent cfc5264 commit 346d352
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Illuminate/Foundation/Console/ListenerMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ protected function buildClass($name)
{
$event = $this->option('event');

if (! Str::startsWith($event, $this->laravel->getNamespace()) &&
! Str::startsWith($event, 'Illuminate')) {
if (! Str::startsWith($event, [
$this->laravel->getNamespace(),
'Illuminate',
'\\',
])) {
$event = $this->laravel->getNamespace().'Events\\'.$event;
}

Expand Down

0 comments on commit 346d352

Please sign in to comment.