hyperf-view/builder/Validate/Annotations/Validation.php

57 lines
1.0 KiB
PHP

<?php
namespace Builder\Validate\Annotations;
use Hyperf\Di\Annotation\AbstractAnnotation;
/**
* @Annotation
* @Target("METHOD")
*/
class Validation extends AbstractAnnotation
{
/**
* 自定义规则
* @var string
*/
public $rules = [];
/**
* 验证器
* @var string
*/
public $validate = '';
/**
* 场景
* @var string
*/
public $value = '';
/**
* 场景
* @var string
*/
public $scene = '';
/**
* 是否过滤多余字段
* @var bool
*/
public $filter = false;
/**
* 安全模式严格按照规则字段,如果多字段会抛出异常
* @var bool
*/
public $security = false;
/**
* 是否批量验证
* @var bool
*/
public $batch = false;
/**
* 验证哪个参数
* @var string
*/
public $field = "data";
public function __construct($value = null)
{
parent::__construct($value);
$this->bindMainProperty('scene', $value);
}
}