Skip to content

Commit

Permalink
[11.x] Fixed class and class.invokable stub paths after publish (#…
Browse files Browse the repository at this point in the history
…50676)

* [11.x] Fixed `class` and `class.invokable` stub paths after publish

* [11.x] fixed styling issue
  • Loading branch information
haroon-mahmood-4276 authored Mar 20, 2024
1 parent b8540dd commit a743d59
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/Illuminate/Foundation/Console/ClassMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,22 @@ class ClassMakeCommand extends GeneratorCommand
*/
protected function getStub()
{
if ($this->option('invokable')) {
return __DIR__.'/stubs/class.invokable.stub';
}
return $this->option('invokable')
? $this->resolveStubPath('/stubs/class.invokable.stub')
: $this->resolveStubPath('/stubs/class.stub');
}

return __DIR__.'/stubs/class.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 a743d59

Please sign in to comment.