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

use think\Validate;

class PackageValidate extends Validate
{
    protected $rule =   [
        'package_name'          => 'require|max:20',
        'package_img'           => 'require',
        'package_id'            => 'require',
        'package_logo'          => 'require',
        'package_type'          => 'require',
        'package_content'       => 'require',
        'package_product_ids'   => 'require',
        'user_id'               => 'require',
        'type'                  => 'require',
    ];

    protected $message  =   [
        'package_name.require'          => '包名1称不能为空',
        'package_id.require'            => 'id不能为空',
        'package_img.require'           => '介绍图不能为空',
        'package_logo.require'          => 'logo不能为空',
        'package_name.max'              => '包名不能超过20字',
        'package_type.require'          => '类型不能为空',
        'package_content.require'       => '购买须知不能为空',
        'package_product_ids.require'   => '品产不能为空',
        'user_id.require'               => '赠送会员编号不能为空',
        'type.require'                  => '类型不能为空'
    ];

    //场景
    protected $scene = [
        'add'           => ['package_name','package_img','package_logo','package_type','package_content','package_product_ids',],
        'update'        => ['package_id'],
        'info'          => ['package_id'],
        'del'           => ['package_id'],
        'give'          => ['package_id', 'user_id', 'type']
    ];
}
