Laravel版本 5.*
use Illuminate\Validation\Rule;
//...
Validator::make($data, [
'email' => [ 'required',Rule::unique('users')->ignore($user->id),
'name' => ['required','min:1','max:100', Rule::unique('users')->ignore($user->id)]
],
]);
Laravel版本 5.*
use Illuminate\Validation\Rule;
//...
Validator::make($data, [
'email' => [ 'required',Rule::unique('users')->ignore($user->id),
'name' => ['required','min:1','max:100', Rule::unique('users')->ignore($user->id)]
],
]);
本文标题:Laravel修改记录验证唯一性,排除自己(当前记录)
本文链接:https://www.haomeiwen.com/subject/ebrtxhtx.html
网友评论