server/app/Request/Role.php

44 lines
816 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 Role extends FormRequest
{
protected array $scenes = [
'add' => ['role_name'],
'edit' => ['role_id', 'role_name'],
];
/**
* 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 [
'role_id' => 'required',
'role_name' => 'required'
];
}
public function messages(): array
{
return [
'role_id.required' => '角色ID必填',
'role_name.required' => '角色名称必填!'
];
}
}