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