lcly-data-admin/app/Http/Requestes/RiceShrimpFlowUpdateRequest...

38 lines
859 B
PHP

<?php
namespace App\Http\Requestes;
use App\Rules\Quarter;
use App\Rules\Year;
use Illuminate\Foundation\Http\FormRequest;
class RiceShrimpFlowUpdateRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'year' => ['filled', 'int', new Year()],
'quarter' => ['filled', new Quarter()],
'area' => ['filled', 'string'],
'sales' => ['filled', 'regex:/^([1-9]\d*|0)(\.\d{1,2})?$/'],
'unit' => ['filled', 'string'],
];
}
public function attributes()
{
return [
'year' => '年份',
'quarter' => '季度',
'area' => '地区',
'sales' => '销量',
'unit' => '单位',
];
}
}