server/app/Request/DictData.php

52 lines
1.4 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Request;
use Hyperf\Validation\Request\FormRequest;
class DictData extends FormRequest
{
protected array $scenes = [
'add' => ["dict_id", "dict_label", "dict_value", "is_default"],
'edit' => ["data_id", "dict_id", "dict_label", "dict_value", "is_default"],
];
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'data_id' => 'required',
'dict_id' => 'required',
'dict_label' => 'required',
'dict_value' => 'required',
'is_default' => 'required',
'rank' => 'required',
'status' => 'required'
];
}
public function messages(): array
{
return [
'data_id.required' => 'ID必传',
'dict_id.required' => '字典ID必传',
'dict_label.required' => '字典标签必传!',
'dict_value.required' => '字典键值必传!',
'is_default.required' => '是否默认必传!',
'rank.required' => '排序必传!',
'status.required' => '是否启用必传!',
'remark.required' => '备注必传!',
];
}
}