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

use think\Validate;

class PlayValidate extends Validate
{
    protected $rule =   [
        'play_name'  => 'require|max:20',
        'play_id'    => 'require',
        'play_content' => 'require',
        'play_img' => 'require',
        'play_valid' => 'require',
        'play_price' => 'require',
        'play_category' => 'require',
        'play_label' => 'require',
        'play_type' => 'require',
        'play_status' => 'require',
        'play_shop_id' => 'require',
        'play_time' => 'require',
    ];

    protected $message  =   [
        'play_id.require' => 'ID不能为空',
        'play_name.require' => '名称不能为空',
        'play_content.require'=> '详情不能为空',
        'play_img.require'   => '图片不能为空',
        'play_name.max'  => '名称不能超过20字',
        'play_valid.require' => '有效期不能为空',
        'play_price.require' => '价格不能为空',
        'play_category.require' => '分类不能为空',
        'play_label.require' => '标签不能为空',
        'play_type.require' => '类型不能为空',
        'play_status.require' => '状态不能为空',
        'play_shop_id.require' => '店铺id不能为空',
        'play_time.require' => '使用时间不能为空',
    ];

    //场景
    protected $scene = [
        'create'   => ['play_name','play_img','play_price','play_category','play_shop_id','play_label','play_content','play_type','play_status','play_valid','play_time'],
        'update'   => ['play_id','play_name','play_img','play_price','play_category','play_shop_id','play_label','play_content','play_type','play_status','play_valid','play_time'],
        'info'     => ['play_id']
    ];
}
