Skip to content

Commit

Permalink
Publish provider.stub in stub:publish command (#39491)
Browse files Browse the repository at this point in the history
  • Loading branch information
VladyslavChernyshov authored Nov 5, 2021
1 parent eb41172 commit 5539cf2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
15 changes: 14 additions & 1 deletion src/Illuminate/Foundation/Console/ProviderMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,20 @@ class ProviderMakeCommand extends GeneratorCommand
*/
protected function getStub()
{
return __DIR__.'/stubs/provider.stub';
return $this->resolveStubPath('/stubs/provider.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
1 change: 1 addition & 0 deletions src/Illuminate/Foundation/Console/StubPublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function handle()
__DIR__.'/stubs/notification.stub' => $stubsPath.'/notification.stub',
__DIR__.'/stubs/observer.plain.stub' => $stubsPath.'/observer.plain.stub',
__DIR__.'/stubs/observer.stub' => $stubsPath.'/observer.stub',
__DIR__.'/stubs/provider.stub' => $stubsPath.'/provider.stub',
__DIR__.'/stubs/request.stub' => $stubsPath.'/request.stub',
__DIR__.'/stubs/resource-collection.stub' => $stubsPath.'/resource-collection.stub',
__DIR__.'/stubs/resource.stub' => $stubsPath.'/resource.stub',
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Foundation/Console/stubs/provider.stub
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace DummyNamespace;
namespace {{ namespace }};

use Illuminate\Support\ServiceProvider;

class DummyClass extends ServiceProvider
class {{ class }} extends ServiceProvider
{
/**
* Register services.
Expand Down

0 comments on commit 5539cf2

Please sign in to comment.