server/app/Request/Dict.php

45 lines
1008 B
PHP
Raw 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 Dict extends FormRequest
{
protected array $scenes = [
'add' => ["dict_name", "dict_type"],
'edit' => ["dict_id", "dict_name", "dict_type"],
];
/**
* 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 [
'dict_id' => 'required',
'dict_name' => 'required',
'dict_type' => 'required',
'remark' => 'required',
];
}
public function messages(): array
{
return [
'dict_id.required' => 'ID必传',
'dict_name.required' => '字典名称必传!',
'dict_type.required' => '字典类型必传!',
'remark.required' => '备注必传!',
];
}
}