<?php
/**
 * @copyright   Copyright (c) 2017 https://www.sapixx.com All rights reserved.
 * @license     Licensed (http://www.apache.org/licenses/LICENSE-2.0).
 * @author      pillar<ltmn@qq.com>
 * 商品分类
 */
namespace app\ais\validate;
use think\Validate;

class Category extends Validate{

    protected $rule = [
        'token'     => 'require|max: 25|token',
        'id'        => 'require|number',
        'parent_id' => 'require|number',
        'sort'      => 'require|number',
        'title'     => 'require',
        'name'      => 'require',
        'content'   => 'require',
        'picture'   => 'require',
    ];

    protected $message = [
        'id'        => 'ID丢失',
        'parent_id' => '上级栏目不存在',
        'sort'      => '排序序号必须填写',
        'title'     => '名称必须填写',
        'name'      => '别名必须填写',
        'content'   => '简介必须填写',
        'picture'   => '专题图片必须填写',
    ];

    protected $scene = [
        'sort' => ['id','sort'],
        'add'  => ['parent_id','sort','title','name'],
        'edit' => ['id','sort','title','name'],
        'save' => ['id','title','content','picture'],
    ];
}