diff --git a/src/Illuminate/Foundation/Console/TraitMakeCommand.php b/src/Illuminate/Foundation/Console/TraitMakeCommand.php index 6f1c3172e06e..a4542018c15c 100644 --- a/src/Illuminate/Foundation/Console/TraitMakeCommand.php +++ b/src/Illuminate/Foundation/Console/TraitMakeCommand.php @@ -37,7 +37,20 @@ class TraitMakeCommand extends GeneratorCommand */ protected function getStub() { - return __DIR__.'/stubs/trait.stub'; + return $this->resolveStubPath('/stubs/trait.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; } /**