| Total Complexity | 6 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | trait MustVerifyMobile |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Determine if the user has verified their mobile number. |
||
| 12 | */ |
||
| 13 | public function hasVerifiedMobile(): bool |
||
| 14 | { |
||
| 15 | return null !== $this->mobile_verified_at; |
||
| 16 | } |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Mark the given user's mobile as verified. |
||
| 20 | */ |
||
| 21 | public function markMobileAsVerified(): bool |
||
| 22 | { |
||
| 23 | return $this->forceFill(['mobile_verified_at' => $this->freshTimestamp()])->save(); |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Send the mobile verification notification. |
||
| 28 | */ |
||
| 29 | public function sendMobileVerifierNotification(string $token): void |
||
| 30 | { |
||
| 31 | $this->notify(new VerifyMobileNotification($token)); |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Get the mobile number that should be used for verification. |
||
| 36 | */ |
||
| 37 | public function getMobileForVerification(): string |
||
| 38 | { |
||
| 39 | return $this->{$this->getMobileField()}; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Get the recipients of the given message. |
||
| 44 | * |
||
| 45 | * @return mixed |
||
| 46 | */ |
||
| 47 | public function routeNotificationForVerificationMobile(): string |
||
| 48 | { |
||
| 49 | return $this->{$this->getMobileField()}; |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @return Repository|mixed |
||
| 54 | */ |
||
| 55 | private function getMobileField() |
||
| 58 | } |
||
| 59 | } |
||
| 60 |