<?php
namespace app\common\validate;

use think\Validate;

class QualityGroup extends Validate{

    protected $rule = [
        'title|名称'  =>  'require|length:1,200',
        'forms|检查项'  =>  'require',
        'type'  =>  'egt:0|checkType',
    ];

    protected $message = [
        'title.length' => '名称必须200字以内',
    ];

    protected $scene = [

    ];

    protected function checkType($value,$rule,$data=[])
    {
        if($data['type'] > 0 && empty($data['busids'])){
            return '未选择关联项';
        }
        return true;
    }

}