Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] Publish the form request stub used by RequestMakeCommand #31962

Merged
merged 2 commits into from
Mar 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/Illuminate/Foundation/Console/RequestMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,20 @@ class RequestMakeCommand extends GeneratorCommand
*/
protected function getStub()
{
return __DIR__.'/stubs/request.stub';
return $this->resolveStubPath('/stubs/request.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 @@ -37,6 +37,7 @@ public function handle()
__DIR__.'/stubs/job.stub' => $stubsPath.'/job.stub',
__DIR__.'/stubs/model.pivot.stub' => $stubsPath.'/model.pivot.stub',
__DIR__.'/stubs/model.stub' => $stubsPath.'/model.stub',
__DIR__.'/stubs/request.stub' => $stubsPath.'/request.stub',
__DIR__.'/stubs/test.stub' => $stubsPath.'/test.stub',
__DIR__.'/stubs/test.unit.stub' => $stubsPath.'/test.unit.stub',
realpath(__DIR__.'/../../Database/Migrations/stubs/migration.create.stub') => $stubsPath.'/migration.create.stub',
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Foundation/Console/stubs/request.stub
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace DummyNamespace;
namespace {{ namespace }};

use Illuminate\Foundation\Http\FormRequest;

class DummyClass extends FormRequest
class {{ class }} extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
Expand Down