I m 相对较新,而I ve 则陷入一个问题。 当用户把自己的信息输入我的系统时,我想绕过电子邮件的确认。 具体来说,他们没有发现电子邮件已经使用错误。 Im利用请求管理数据更新。
相关法典:
public function rules(): array
{
$userId = $this->input( id );
$userEmail = $this->input( email );
return [
name => required ,
surname => required ,
id => required , numeric , min_digits:8 , max_digits:8 ,
tin => [ required , numeric , min_digits:11 , max_digits:11 , new ValidateDniTinMatch],
date_of_birth => required|date|before_or_equal: . now()->format( d-m-Y ),
email => [
required ,
unique:owners,email, .$userEmail,
Rule::unique( owners )->ignore($userEmail)
],
mobile_phone => required ,
alternative_mobile_phone => nullable|different:phone_number ,
address => required ,
city => required ,
province => required ,
country => required ,
zip_code => required|numeric ,
];
}
在我在线研究以及Laravel文献中,我找到了解决这一问题的两个潜在解决办法:
Rule::unique( owners )->ignore($userEmail)
and
unique:owners,email, .$userEmail
As you can see in the code I provided, I ve tried both:
email => [
required ,
unique:owners,email, .$userEmail,
Rule::unique( owners )->ignore($userEmail)
],
然而,这两种解决办法都没有奏效。 我不敢确定什么是尝试的,我感到有点损失。