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

[11.x] Fixes make:model for Form Requests #53052

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Changes from 1 commit
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
20 changes: 20 additions & 0 deletions src/Illuminate/Foundation/Console/ModelMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public function handle()

if ($this->option('controller') || $this->option('resource') || $this->option('api')) {
$this->createController();
} elseif ($this->option('requests')) {
$this->createFormRequests();
}

if ($this->option('policy')) {
Expand Down Expand Up @@ -148,6 +150,24 @@ protected function createController()
]));
}

/**
* Create form requests for the model.
*
* @return void
*/
protected function createFormRequests()
{
$request = Str::studly(class_basename($this->argument('name')));

$this->call('make:request', [
'name' => "Store{$request}Request",
]);

$this->call('make:request', [
'name' => "Update{$request}Request",
]);
}

/**
* Create a policy file for the model.
*
Expand Down