server/app/Request/Menu.php

50 lines
1.1 KiB
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 Menu extends FormRequest
{
protected array $scenes = [
'add' => ['parent_id', 'title', 'account_type', 'type'],
'edit' => ['parent_id', 'title', 'account_type', 'type','menu_id'],
];
/**
* 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 [
'menu_id' => 'required',
'parent_id' => 'required',
'title' => 'required',
'account_type' => 'required',
'type' => 'required'
];
}
public function messages(): array
{
return [
'menu_id.required' => '菜单ID必填',
'parent_id.required' => '上级ID必选',
'title.required' => '菜单名称必填!',
'account_type.required' => '菜单归属必填!',
'type.required' => '菜单类型必填!'
];
}
}