<?php
namespace app\api\validate;

use think\Validate;

class User extends Validate
{
    protected $rule =   [
        'username'  => 'require|max:25',
        'password'  => 'require|length:6,32',
        'nickname'  => 'require|max:25',
        'mobile'    => 'require|mobile|number|length:11',
        'email' => 'email',  
        'password' => 'require|length:6,32',
        'repassword' => 'require|length:6,32|confirm:password',
        'oldpassword' => 'require|length:6,32',
        'id_card'  => 'require|idCard',
        'sex'  => 'require|in:1,2',
        'list'  => 'require'

        
        
    ];
    
    protected $message  =   [
        'name'      => '名称必须',
        'password'  => '密码长度只能在6-32之间',
        'email'     => '邮箱格式错误', 
        'mobile'    => '手机号格式错误',
        'nickname'  => '昵称格式错误',
        'oldpassword' => '旧密码错误',
        'repassword' => '两次密码不一致',
        'id_card' => '身份证格式错误',
        'list' => '请选择出工人员'
    ];


 
    protected $scene = [
        'login'  =>  ['name','password'],
        'edit'   =>  ['mobile','nickname','email'],
        'password' => ['password','oldpassword', 'repassword'],
        'add_group_user'   =>  ['nickname','id_card','mobile','sex'],
        'edit_group_user'   =>  ['id','nickname','id_card','mobile','sex'],
        'set_worker_out'   =>  ['list']
        
    ]; 
}