Skip to content

Commit bafbec4

Browse files
authoredMar 18, 2024
[11.x] Fixed enum and enum.backed stub paths after publish (#50629)
* [11.x] Fixed enum and enum.backed stub paths after publish * [11.x] linting issue
1 parent 50124be commit bafbec4

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed
 

‎src/Illuminate/Foundation/Console/EnumMakeCommand.php

+15-2
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,23 @@ class EnumMakeCommand extends GeneratorCommand
4242
protected function getStub()
4343
{
4444
if ($this->option('string') || $this->option('int')) {
45-
return __DIR__.'/stubs/enum.backed.stub';
45+
return $this->resolveStubPath('/stubs/enum.backed.stub');
4646
}
4747

48-
return __DIR__.'/stubs/enum.stub';
48+
return $this->resolveStubPath('/stubs/enum.stub');
49+
}
50+
51+
/**
52+
* Resolve the fully-qualified path to the stub.
53+
*
54+
* @param string $stub
55+
* @return string
56+
*/
57+
protected function resolveStubPath($stub)
58+
{
59+
return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
60+
? $customPath
61+
: __DIR__.$stub;
4962
}
5063

5164
/**

0 commit comments

Comments
 (0)