Files
webman-buildadmin/support/bootstrap/ValidateInit.php
zhenhui e65c3474bd 1.修改电话号码格式为60前缀,马来西亚格式
2.优化渠道可以查看分红方式,可以查看游玩详情
2026-05-30 11:09:54 +08:00

27 lines
657 B
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
declare(strict_types=1);
namespace support\bootstrap;
use app\common\library\MalaysiaMobilePhone;
use think\Validate;
use support\think\Db;
use Workerman\Worker;
/**
* 验证器引导:为 think-validate 注入 Db使 unique 等规则可用
*/
class ValidateInit implements \Webman\Bootstrap
{
public static function start(?Worker $worker): void
{
Validate::maker(function (Validate $validate): void {
$validate->setDb(Db::connect());
$validate->extend('mobile', static function ($value): bool {
return MalaysiaMobilePhone::isValid((string) $value);
});
});
}
}