Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.

Commit ebd289d

Browse files
committed
Made logic to get mobile phone number overridable.
1 parent 368f859 commit ebd289d

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/Providers/MessageBirdVerify.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ public function verify(User $user, string $token)
110110
*/
111111
public function sendSMSToken(User $user) : void
112112
{
113-
if (!$user->mobile) {
113+
if (!$user->getMobile()) {
114114
throw new Exception("No mobile phone number found for user {$user->id}.");
115115
}
116116

117117
$verify = new Verify;
118-
$verify->recipient = $user->mobile;
118+
$verify->recipient = $user->getMobile();
119119

120120
$result = $this->client->verify->create(
121121
$verify,

src/TwoFactorAuthenticable.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88

99
trait TwoFactorAuthenticable
1010
{
11+
/**
12+
* Get the mobile phone number to be used. Override in your User model to suit your application.
13+
* @return string
14+
*/
15+
public function getMobile() : string
16+
{
17+
return $this->mobile;
18+
}
19+
1120
/**
1221
* Get the two-factor auth record associated with the user.
1322
*

0 commit comments

Comments
 (0)