diff --git a/src/Illuminate/Foundation/Console/EnumMakeCommand.php b/src/Illuminate/Foundation/Console/EnumMakeCommand.php index d30bc7c86f6e..a7cfb87c9318 100644 --- a/src/Illuminate/Foundation/Console/EnumMakeCommand.php +++ b/src/Illuminate/Foundation/Console/EnumMakeCommand.php @@ -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; } /**