From 5568d633057215592f5d38db1782b6dd1d47d4d1 Mon Sep 17 00:00:00 2001 From: chrisinit Date: Sun, 12 Dec 2021 18:48:36 -0500 Subject: [PATCH] Publish view-component.stub --- .../Foundation/Console/ComponentMakeCommand.php | 15 ++++++++++++++- .../Foundation/Console/StubPublishCommand.php | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Console/ComponentMakeCommand.php b/src/Illuminate/Foundation/Console/ComponentMakeCommand.php index 69edcc536434..b0a3344180b4 100644 --- a/src/Illuminate/Foundation/Console/ComponentMakeCommand.php +++ b/src/Illuminate/Foundation/Console/ComponentMakeCommand.php @@ -121,7 +121,20 @@ protected function getView() */ protected function getStub() { - return __DIR__.'/stubs/view-component.stub'; + return $this->resolveStubPath('/stubs/view-component.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; } /** diff --git a/src/Illuminate/Foundation/Console/StubPublishCommand.php b/src/Illuminate/Foundation/Console/StubPublishCommand.php index ed5f2215bd84..4594f07cd197 100644 --- a/src/Illuminate/Foundation/Console/StubPublishCommand.php +++ b/src/Illuminate/Foundation/Console/StubPublishCommand.php @@ -55,6 +55,7 @@ public function handle() __DIR__.'/stubs/rule.stub' => $stubsPath.'/rule.stub', __DIR__.'/stubs/test.stub' => $stubsPath.'/test.stub', __DIR__.'/stubs/test.unit.stub' => $stubsPath.'/test.unit.stub', + __DIR__.'/stubs/view-component.stub' => $stubsPath.'/view-component.stub', realpath(__DIR__.'/../../Database/Console/Factories/stubs/factory.stub') => $stubsPath.'/factory.stub', realpath(__DIR__.'/../../Database/Console/Seeds/stubs/seeder.stub') => $stubsPath.'/seeder.stub', realpath(__DIR__.'/../../Database/Migrations/stubs/migration.create.stub') => $stubsPath.'/migration.create.stub',