<?php

namespace app\admin\validate\at_home;

use support\Validate;

class GoodsValidate extends Validate
{
    protected $rule = [
        'goods_id' => 'require|integer',
        'goods_category_id' => 'require|in:108,109,110,111,112,113',
        'goods_name|商品名称' => 'require',
        'goods_img|图片' => 'require|regex:/^[0-9a-zA-Z\.\/]+$/',
        'goods_mobile|联系电话' => 'require|mobile',
        'goods_status|状态' => 'require|in:0,1',
        'goods_sort|排序' => 'require|integer'
    ];

    protected $message = [];

    protected $scene = [
        'add' => ['goods_category_id', 'goods_name', 'goods_img', 'goods_mobile', 'goods_status', 'goods_sort'],
        'update' => ['goods_id', 'goods_category_id', 'goods_name', 'goods_img', 'goods_mobile', 'goods_status', 'goods_sort'],
    ];
}