Skip to content

Commit

Permalink
[11.x] Fixes make:model for Form Requests (#53052)
Browse files Browse the repository at this point in the history
* Fix "make:model" for Form Requests

* formatting

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
joshmanders and taylorotwell authored Oct 8, 2024
1 parent 582c822 commit bc02689
Showing 1 changed file with 20 additions and 0 deletions.
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 the 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

0 comments on commit bc02689

Please sign in to comment.