2 回答
TA贡献1852条经验 获得超1个赞
这将检查用户电话号码,如电子邮件。它将分配唯一的用户电话号码
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
'phone' => 'required|unique:users,phone'
]);
}
用于在套准刀片中显示错误
@error('phone')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
TA贡献1824条经验 获得超8个赞
您需要将这样的内容添加到 RegisterController.php
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
'phone' => 'required'
]);
}
- 2 回答
- 0 关注
- 132 浏览
添加回答
举报