Skip to content

Commit a743d59

Browse files
[11.x] Fixed class and class.invokable stub paths after publish (#50676)
* [11.x] Fixed `class` and `class.invokable` stub paths after publish * [11.x] fixed styling issue
1 parent b8540dd commit a743d59

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/Illuminate/Foundation/Console/ClassMakeCommand.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,22 @@ class ClassMakeCommand extends GeneratorCommand
3737
*/
3838
protected function getStub()
3939
{
40-
if ($this->option('invokable')) {
41-
return __DIR__.'/stubs/class.invokable.stub';
42-
}
40+
return $this->option('invokable')
41+
? $this->resolveStubPath('/stubs/class.invokable.stub')
42+
: $this->resolveStubPath('/stubs/class.stub');
43+
}
4344

44-
return __DIR__.'/stubs/class.stub';
45+
/**
46+
* Resolve the fully-qualified path to the stub.
47+
*
48+
* @param string $stub
49+
* @return string
50+
*/
51+
protected function resolveStubPath($stub)
52+
{
53+
return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
54+
? $customPath
55+
: __DIR__.$stub;
4556
}
4657

4758
/**

0 commit comments

Comments
 (0)