Call to undefined method Illuminate\Database\Query\Builder::withTrashed() with form validation
我的验证码怎么了?
1 2 3 4 5 6 7 8 9 10 | request()->validate([ 'name'=>['required', Rule::unique('users', 'name')->where(function($query) { $query->withTrashed(); })], 'email'=>['required', Rule::unique('users')->where(function($query) { $query->withTrashed(); })], 'password'=>'required|min:6|max:20|confirmed', 'g-recaptcha-response' => 'required|captcha', ]); |
在我的用户模型中,我声明使用
但是当我要验证数据时,出现此错误:
Call to undefined method
Illuminate\\Database\\Query\\Builder::withTrashed()
感谢您的帮助。
由于这个原因,验证引擎确实使用了
这并不是一个真正的问题,因为在使用唯一验证规则时,甚至没有应用全局软可删除过滤器。换句话说,您无需执行任何操作-删除的元素无论如何都将被视为。