扩展功能

This commit is contained in:
wuyanwen
2019-12-06 09:17:40 +08:00
parent 397c8bb7f7
commit 5c7765c97f
18 changed files with 1396 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<?php
namespace catcher\base;
use catcher\validates\Uniques;
use think\Validate;
abstract class BaseValidate extends Validate
{
public function __construct()
{
parent::__construct();
$this->register();
$this->rule = $this->getRules();
}
abstract protected function getRules(): array ;
private function register()
{
if (!empty($this->newValidates())) {
foreach ($this->newValidates() as $validate) {
$this->extend($validate->type(), [$validate, 'verify'], $validate->message());
}
}
}
private function newValidates()
{
return [
];
}
}