Laravel 10.xのartisanの「make:request」コマンドを解説します。
Description
新しいフォームリクエストクラスを作成します。
Usage
php artisan make:request [-f|--force] [--] <name>Arguments
| 引数 | 必須 | 設営 |
|---|---|---|
| name | 必須 | フォームリクエストクラス名 |
Options
| オプション | 省略形 | 必須 | 説明 |
|---|---|---|---|
| force | f | – | リクエストが既に存在する場合でも、クラスを作成 |
Examples
no options
php artisan make:request FooRequest INFO Request [app/Http/Requests/FooRequest.php] created successfully. <?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class FooRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
//
];
}
}Stub
| Option | Stub file name |
|---|---|
| – | request.stub |
Source
10.x
framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php at 10.x · laravel/framework
The Laravel Framework. Contribute to laravel/framework development by creating an account on GitHub.
11.x
framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php at 11.x · laravel/framework
The Laravel Framework. Contribute to laravel/framework development by creating an account on GitHub.


コメント