<?php
namespace App\Http\Requests;
class MyRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'first_field' => 'min:0',
'second_field' => 'min:'.$this->first_field,
];
}
}
1 回答
您可以通过运行
php artisan make:request MyRequest
在app/Http/Requests
中添加验证,如下所示:您可以找到有关验证的更多信息here