| Conditions | 6 |
| Paths | 8 |
| Total Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | protected function prepareForValidation(): void |
||
| 30 | { |
||
| 31 | $data = $this->all(); |
||
| 32 | |||
| 33 | $country = $data['country_code'] ?? null; |
||
| 34 | $email = $data['email'] ?? null; |
||
| 35 | $phone = $data['phone'] ?? null; |
||
| 36 | $user = $this->user($this->route('guard')); |
||
| 37 | $twoFactor = $user->getTwoFactor(); |
||
| 38 | |||
| 39 | if ($email !== $user->email) { |
||
| 40 | $data['email_verified_at'] = null; |
||
| 41 | } |
||
| 42 | |||
| 43 | if ($phone !== $user->phone || $country !== $user->country_code) { |
||
| 44 | $data['phone_verified_at'] = null; |
||
| 45 | } |
||
| 46 | |||
| 47 | if ($twoFactor || is_null($data['phone_verified_at'])) { |
||
| 48 | array_set($twoFactor, 'phone.enabled', false); |
||
| 49 | $data['two_factor'] = $twoFactor; |
||
| 50 | } |
||
| 51 | |||
| 52 | $this->replace($data); |
||
| 53 | } |
||
| 54 | |||
| 68 |