<?php
namespace app\admin\validate\menu;

use think\Validate;

class MenuValidate extends Validate
{
    protected $rule =   [
        'menu_name'  => 'require|max:20',
        'menu_id'    => 'require',
        'menu_path'   => 'require',
        'menu_route'   => 'require',
        'menu_params'   => 'require',
        'menu_is_show'   => 'require',
        'menu_is_menu'   => 'require',
        'menu_sort'   => 'require',
    ];

    protected $message  =   [
        'menu_name.require'   => '菜单名称不能为空',
        'menu_pid.require'    => '菜单父级id不能为空',
        'menu_path.require'   => '菜单路径不能为空',
        'menu_route.require'  => '菜单路由不能为空',
        'menu_params.require' => '菜单参数不能为空',
        'menu_is_show.require'=> '菜单是否显示不能为空',
        'menu_is_menu.require'=> '类型不能为空',
        'menu_sort.require'   => '菜单排序不能为空',
        'menu_id.require'     => '菜单id不能为空',
        'menu_name.max'       => '菜单名称不能超过20字'
    ];

    //场景
    protected $scene = [
        'create'   => ['menu_name','menu_pid','menu_is_show','menu_is_menu'],
        'update'   => ['menu_id'],
        'info'     => ['menu_id']
    ];
}
