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