Skip to content

Commit

Permalink
[7.x ] Publish rule stub (#32097)
Browse files Browse the repository at this point in the history
* publish rule stub

* use placeholders
  • Loading branch information
freekmurze authored Mar 25, 2020
1 parent 1574654 commit 5829f30
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/Illuminate/Foundation/Console/RuleMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ class RuleMakeCommand extends GeneratorCommand
*/
protected function getStub()
{
return __DIR__.'/stubs/rule.stub';
$relativePath = '/stubs/rule.stub';

return file_exists($customPath = $this->laravel->basePath(trim($relativePath, '/')))
? $customPath
: __DIR__.$relativePath;
}

/**
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()
realpath(__DIR__.'/../../Database/Migrations/stubs/migration.update.stub') => $stubsPath.'/migration.update.stub',
realpath(__DIR__.'/../../Foundation/Console/stubs/policy.plain.stub') => $stubsPath.'/policy.plain.stub',
realpath(__DIR__.'/../../Foundation/Console/stubs/policy.stub') => $stubsPath.'/policy.stub',
realpath(__DIR__.'/../../Foundation/Console/stubs/rule.stub') => $stubsPath.'/rule.stub',
realpath(__DIR__.'/../../Routing/Console/stubs/controller.api.stub') => $stubsPath.'/controller.api.stub',
realpath(__DIR__.'/../../Foundation/Console/stubs/console.stub') => $stubsPath.'/console.stub',
realpath(__DIR__.'/../../Routing/Console/stubs/controller.invokable.stub') => $stubsPath.'/controller.invokable.stub',
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Foundation/Console/stubs/rule.stub
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace DummyNamespace;
namespace {{ namespace }};

use Illuminate\Contracts\Validation\Rule;

class DummyClass implements Rule
class {{ class }} implements Rule
{
/**
* Create a new rule instance.
Expand Down

0 comments on commit 5829f30

Please sign in to comment.