44 lines
1.4 KiB
PHP
44 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requestes;
|
|
|
|
use App\Rules\Quarter;
|
|
use App\Rules\Year;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class RiceShrimpIndustryStoreRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
'year' => ['required', 'int', new Year()],
|
|
'quarter' => ['required', new Quarter()],
|
|
'area' => ['required', 'numeric', 'min:0', 'max:9999999999.99', 'regex:/^([1-9]\d*|0)(\.\d{1,2})?$/'],
|
|
'area_unit' => ['required', 'string'],
|
|
'product_output' => ['required', 'numeric', 'min:0', 'max:9999999999.99', 'regex:/^([1-9]\d*|0)(\.\d{1,2})?$/'],
|
|
'product_output_unit' => ['required', 'string'],
|
|
'product_value' => ['required', 'numeric', 'min:0', 'max:9999999999.99', 'regex:/^([1-9]\d*|0)(\.\d{1,2})?$/'],
|
|
'product_value_unit' => ['required', 'string'],
|
|
];
|
|
}
|
|
|
|
public function attributes()
|
|
{
|
|
return [
|
|
'year' => '年份',
|
|
'quarter' => '季度',
|
|
'area' => '面积',
|
|
'area_unit' => '面积单位',
|
|
'product_output' => '产量',
|
|
'product_output_unit' => '产量单位',
|
|
'product_value' => '产值',
|
|
'product_value_unit' => '产值单位',
|
|
];
|
|
}
|
|
}
|