From fd6a404324eb1876e07d4df93f9c4be4969b1297 Mon Sep 17 00:00:00 2001 From: haroon-mahmood-4276 Date: Tue, 19 Mar 2024 00:39:32 +0500 Subject: [PATCH 1/2] [11.x] Fixed enum and enum.backed stub paths after publish --- .../Foundation/Console/EnumMakeCommand.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Foundation/Console/EnumMakeCommand.php b/src/Illuminate/Foundation/Console/EnumMakeCommand.php index d30bc7c86f6e..45a3d1d30ee3 100644 --- a/src/Illuminate/Foundation/Console/EnumMakeCommand.php +++ b/src/Illuminate/Foundation/Console/EnumMakeCommand.php @@ -42,10 +42,23 @@ class EnumMakeCommand extends GeneratorCommand protected function getStub() { if ($this->option('string') || $this->option('int')) { - return __DIR__.'/stubs/enum.backed.stub'; + return $this->resolveStubPath('/stubs/enum.backed.stub'); } - return __DIR__.'/stubs/enum.stub'; + return $this->resolveStubPath('/stubs/enum.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; } /** From f9993a3a78bd687a43d8b557e888e3ebf72a08e4 Mon Sep 17 00:00:00 2001 From: haroon-mahmood-4276 Date: Tue, 19 Mar 2024 00:42:12 +0500 Subject: [PATCH 2/2] [11.x] linting issue --- src/Illuminate/Foundation/Console/EnumMakeCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Foundation/Console/EnumMakeCommand.php b/src/Illuminate/Foundation/Console/EnumMakeCommand.php index 45a3d1d30ee3..a7cfb87c9318 100644 --- a/src/Illuminate/Foundation/Console/EnumMakeCommand.php +++ b/src/Illuminate/Foundation/Console/EnumMakeCommand.php @@ -57,8 +57,8 @@ protected function getStub() protected function resolveStubPath($stub) { return file_exists($customPath = $this->laravel->basePath(trim($stub, '/'))) - ? $customPath - : __DIR__ . $stub; + ? $customPath + : __DIR__.$stub; } /**