33 lines
706 B
PHP
33 lines
706 B
PHP
<?php
|
|
|
|
namespace App\Http\Requestes;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class RiceShrimpPriceStoreRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
'year' => ['required', 'int'],
|
|
'quarter' => ['required', 'int', Rule::in([1, 2, 3, 4])],
|
|
'price' => ['required', 'regex:/^([1-9]\d*|0)(\.\d{1,2})?$/'],
|
|
];
|
|
}
|
|
|
|
public function attributes()
|
|
{
|
|
return [
|
|
'year' => '年份',
|
|
'quarter' => '季度',
|
|
'price' => '价格',
|
|
];
|
|
}
|
|
}
|