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

use think\Validate;

class HealthyProductValidate extends Validate
{
    protected $rule =   [
        'product_name'  => 'require|max:20',
        'product_id'    => 'require',
        'product_price' => 'require',
        'product_postage_id' => 'require',
        'product_category_id' => 'require',
        'product_shop_id' => 'require',
        'product_status' => 'require',
        'product_weight' => 'require',
        'product_type' => 'require',
        'product_pack_price' => 'require',
    ];

    protected $message  =   [
        'product_id.require' => '健康产品ID不能为空',
        'product_name.require' => '健康产品名称不能为空',
        'product_price.require'=> '健康产品价格不能为空',
        'product_status.require'   => '健康产品状态不能为空',
        'product_name.max'  => '健康产品名称不能超过20字',
        'product_category_id.require' => '健康产品分类不能为空',
        'product_shop_id.require' => '健康产品店铺id不能为空',
        'product_pack_price.require' => '健康产品运费不能为空',
        'product_postage_id.require' => '运费模板id不能为空',
        'product_weight.require' => '产品重量不能为空',
        'product_type.require' => '健康产品分类不能为空',
    ];

    //场景
    protected $scene = [
        'create'   => ['product_name','product_title','product_pack_price','product_category_id','product_price','product_shop_id','product_status','product_weight','product_type','product_postage_id'],
        'update'   => ['product_name','product_title','product_pack_price','product_category_id','product_price','product_shop_id','product_status','product_weight','product_type','product_postage_id'],
        'info'     => ['product_id'],
        'auto'     => ['product_id','product_auto']
    ];
}
