<?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());
        });
    }
}
