<?php


namespace app\admin\validate;


class ConfigValidate extends BaseValidate
{

     /**
      * 设置校验规则
      * @var string[]
      */
    protected $rule = [
        'id' => 'require',
        'field' => 'require|length:1,50',
        'val' => 'require|length:0,2000',
        'remark' => 'length:0,100',
        'weight' => 'integer',
        'flag' => 'require|in:0,1,2,3,4',
        'type' => 'require',
    ];

    /**
     * 参数描述
     * @var string[]
     */
    protected $field = [
        'id' => 'id',
        'field' => '参数名',
        'val' => '参数值',
        'remark' => '备注',
        'weight' => '权重',
        'type' => '类型',
        'flag' => '标志',
        'unit' => '单位',
        'language_code' => '语言代码',
    ];

    /**
     * @notes 编辑场景
     */
    public function sceneAdd()
    {
        return $this->only(['field', 'val', 'remark', 'weight', 'type', 'flag', 'unit', 'language_code']);
    }

    /**
     * @notes 编辑场景
     */
    public function sceneEdit()
    {
        return $this->only(['id', 'val', 'remark', 'language_code']);
    }

    public function sceneId()
    {
        return $this->only(['id']);
    }

}