From b8540dd5e3b9c7e0f2d4bb31b051c327461b20e3 Mon Sep 17 00:00:00 2001 From: Haroon Mahmood <70590766+haroon-mahmood-4276@users.noreply.github.com> Date: Thu, 21 Mar 2024 01:05:45 +0500 Subject: [PATCH] [11.x] Fixed `trait` stub paths after publish (#50678) --- .../Foundation/Console/TraitMakeCommand.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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; } /**