Skip to content

Commit

Permalink
[11.x] Fixed enum and enum.backed stub paths after publish (#50629)
Browse files Browse the repository at this point in the history
* [11.x] Fixed enum and enum.backed stub paths after publish

* [11.x] linting issue
  • Loading branch information
haroon-mahmood-4276 authored Mar 18, 2024
1 parent 50124be commit bafbec4
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/Illuminate/Foundation/Console/EnumMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,23 @@ class EnumMakeCommand extends GeneratorCommand
protected function getStub()
{
if ($this->option('string') || $this->option('int')) {
return __DIR__.'/stubs/enum.backed.stub';
return $this->resolveStubPath('/stubs/enum.backed.stub');
}

return __DIR__.'/stubs/enum.stub';
return $this->resolveStubPath('/stubs/enum.stub');
}

/**
* Resolve the fully-qualified path to the stub.
*
* @param string $stub
* @return string
*/
protected function resolveStubPath($stub)
{
return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
? $customPath
: __DIR__.$stub;
}

/**
Expand Down

0 comments on commit bafbec4

Please sign in to comment.