Open gyp719 opened 1 year ago
需要 配置策略 你可以通过以下方式注册一个或多个自定义校验规则,决定是否通过校验:
// 文字 Tms::setStrategy('strict', function($result) { return $result['Suggestion'] === 'Pass'; });
// 图片 Ims::setStrategy('logo', function($result) { return $result['Suggestion'] === 'Pass'; });
不管是什么图片都是被审核为敏感图片
$this->validate($request, [ 'name' => 'required|tms', 'logo_url' => 'required|url|ims', ]);
// 图片 Ims::setStrategy('logo', function($result) { return $result['Suggestion'] === 'Pass'; });
打印 $result 并没有任何输出
$contents = 'http://image2.sina.com.cn/lx/2004-12-31/U766P8T1D130969F913DT20041231122251.jpg'; // $res = \Overtrue\LaravelQcloudContentAudit\Ims::check( file_get_contents($contents));
dd($res);
是可以正常输出
"message": "Method Illuminate\Validation\Validator::validateTms does not exist.", "exception": "BadMethodCallException", "file": "/home/vagrant/Code/Tools/vendor/laravel/framework/src/Illuminate/Validation/Validator.php", "line": 1575, "trace": [ { "file": "/home/vagrant/Code/Tools/vendor/laravel/framework/src/Illuminate/Validation/Validator.php", "line": 624, "function": "__call", "class": "Illuminate\Validation\Validator", "type": "->" }, { "file": "/home/vagrant/Code/Tools/vendor/laravel/framework/src/Illuminate/Validation/Validator.php", "line": 430, "function": "validateAttribute", "class": "Illuminate\Validation\Validator", "type": "->" }, { "file": "/home/vagrant/Code/Tools/vendor/laravel/framework/src/Illuminate/Validation/Validator.php", "line": 461, "function": "passes", "class": "Illuminate\Validation\Validator", "type": "->" },