Files
dafuweng-buildadmin/dafuweng-webman/support/bootstrap/ValidateInit.php
2026-03-07 19:42:22 +08:00

23 lines
454 B
PHP
Raw 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 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());
});
}
}