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