diff --git a/catch/CatchAdminService.php b/catch/CatchAdminService.php index 89c3624..510e11b 100644 --- a/catch/CatchAdminService.php +++ b/catch/CatchAdminService.php @@ -62,12 +62,11 @@ class CatchAdminService extends Service */ protected function registerValidates(): void { - $validates = [ - new Sometimes(), - ]; + Validate::maker(function($validate) { + $validates = config('catch.validates'); - Validate::maker(function($validate) use ($validates){ foreach ($validates as $vali) { + $vali = app()->make($vali); $validate->extend($vali->type(), [$vali, 'verify'], $vali->message()); } }); diff --git a/config/catch.php b/config/catch.php index 248776b..4a99092 100644 --- a/config/catch.php +++ b/config/catch.php @@ -33,4 +33,8 @@ return [ ], ], ], + + 'validates' => [ + \catcher\validates\Sometimes::class, + ], ];