diff --git a/README.md b/README.md index 41ae9b0..b84d576 100644 --- a/README.md +++ b/README.md @@ -144,12 +144,12 @@ It's important to know the Order in which the recipient phone number the notific 2) if you did not define routeNotificationForAfricasTalking() method on the Notifiable class (User.php in this case), then the phone_number attribute of the User will be used ($user->phone_number) -3) Lastly if 1 and 2 are not set, then you can set the recipient phone number using ->to(19283281921) +3) Lastly if the recipient phone number is set using ->to(1111111), this will overide the phone number provided in either 1 or 2. ``` php return (new AfricasTalkingMessage()) ->content('Your SMS message content') - ->to("put the recipient phonenumber here"); + ->to("put the recipient phonenumber here"); //eg ->to(11111111) ``` ## Testing diff --git a/src/AfricasTalkingChannel.php b/src/AfricasTalkingChannel.php index f42a5d4..7c6cc4e 100644 --- a/src/AfricasTalkingChannel.php +++ b/src/AfricasTalkingChannel.php @@ -31,7 +31,11 @@ public function send($notifiable, Notification $notification) $message = $notification->toAfricasTalking($notifiable); if (!$phoneNumber = $notifiable->routeNotificationFor('africasTalking')) { - $phoneNumber = $notifiable->phone_number ?? $message->getTo(); + $phoneNumber = $notifiable->phone_number; + } + + if(!empty($message->getTo())) { + $phoneNumber = $message->getTo(); } if(empty($phoneNumber)) {