<?php

namespace app\admin\validate\life;

use support\Validate;

class FarmPackageValidate extends Validate
{
    protected $rule = [
        'package_id' => 'require|integer',
        'package_shop_id' => 'require|integer',
        'package_category_id' => 'require|integer',
        'package_cate' => 'in:次卡,月卡,年卡',
        'package_type' => 'require|integer',
        'package_name' => 'require',
        'package_image' => 'regex:/^[0-9a-zA-Z\/\.]+$/',
        'package_slide' => 'regex:/^[0-9a-zA-Z\/\.\,]+$/',
        'package_tags' => '/^[\x{4e00}-\x{9fa5}a-zA-Z0-9\_\-\,]+$/u',
        'package_price' => 'require|float',
        'package_grade' => 'integer',
        'package_usefulday' => 'integer',
        'package_sales' => 'integer'
    ];

    protected $message = [];

    protected $scene = [
        'add' => ['package_shop_id', 'package_category_id', 'package_cate', 'package_type', 'package_name', 'package_image', 'package_slide', 'package_tags', 'package_price', 'package_grade', 'package_usefulday', 'package_sales'],
        'update' => ['package_id', 'package_shop_id', 'package_category_id', 'package_cate', 'package_type', 'package_name', 'package_image', 'package_slide', 'package_tags', 'package_price', 'package_grade', 'package_usefulday', 'package_sales'],
    ];
}