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

use think\Validate;

class ProductValidate extends Validate
{
    protected $rule =   [
        'product_name'  => 'require|max:20',
        'product_id'    => 'require',
        'product_category_id' => 'require',
    ];

    protected $message  =   [
        'product_name.require' => '智能产品名称不能为空',
        'product_id.require'   => '产品id不能为空',
        'product_name.max'  => '智能产品名称不能超过20字',
        'product_category_id'  => '分类id不能为空',
    ];

    //场景
    protected $scene = [
        'create'   => ['product_name','product_category_id'],
        'update'   => ['product_id'],
        'info'     => ['product_id']
    ];
}
