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

use think\Validate;

class PackageValidate extends Validate
{
    protected $rule =   [
        'package_name'  => 'require|max:100',
        'shop_id'    => 'require',
        'package_image' => 'require',
        'package_images' => 'require',
        'package_usetime' => 'require',
        'package_tags'    => 'require',
        'package_price' => 'require',
        'package_grade' => 'require',
        'package_usefulday' => 'require',
        'package_starttime'    => 'require',
        'package_endtime' => 'require',
        'package_intro' => 'require',
        'package_sales' => 'require',
    ];

    protected $message  =   [
        'package_name'  => '套餐名不能为空',
        'shop_id'    => '店铺id不能为空',
        'package_image' => '套餐主图不能为空',
        'package_images' => '套餐轮播图不能为空',
        'package_usetime' => '套餐可用时段不能为空',
        'package_tags'    => '套餐标签不能为空',
        'package_price' => '套餐价格不能为空',
        'package_grade' => '套餐评分不能为空',
        'package_usefulday' => '套餐有效期不能为空',
        'package_starttime'    => '套餐开始使用时间不能为空',
        'package_endtime' => '套餐结束使用时间不能为空',
        'package_intro' => '购买须知不能为空',
        'package_sales' => '销量不能为空',
    ];

    //场景
    protected $scene = [
        'create'   => ['package_name','shop_id','package_image','package_images','package_price','package_usefulday','package_starttime','package_endtime','package_intro'],
        'update'   => ['package_id'],
        'info'     => ['package_id']
    ];
}
