Skip to content

Commit

Permalink
add unicode to message
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Nov 29, 2016
1 parent cfba9f7 commit 3001640
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Notifications/Channels/NexmoSmsChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function send($notifiable, Notification $notification)
}

return $this->nexmo->message()->send([
'type' => 'unicode',
'type' => $message->type,
'from' => $message->from ?: $this->from,
'to' => $to,
'text' => trim($message->content),
Expand Down
19 changes: 19 additions & 0 deletions src/Illuminate/Notifications/Messages/NexmoMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ class NexmoMessage
*/
public $from;

/**
* The message type.
*
* @var string
*/
public $type = 'text';

/**
* Create a new message instance.
*
Expand Down Expand Up @@ -54,4 +61,16 @@ public function from($from)

return $this;
}

/**
* Set the message type.
*
* @return $this
*/
public function unicode()
{
$this->type = 'unicode';

return $this;
}
}
4 changes: 3 additions & 1 deletion tests/Notifications/NotificationNexmoChannelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function testSmsIsSentViaNexmo()
);

$nexmo->shouldReceive('message->send')->with([
'type' => 'text',
'from' => '4444444444',
'to' => '5555555555',
'text' => 'this is my message',
Expand All @@ -38,6 +39,7 @@ public function testSmsIsSentViaNexmoWithCustomFrom()
);

$nexmo->shouldReceive('message->send')->with([
'type' => 'unicode',
'from' => '5554443333',
'to' => '5555555555',
'text' => 'this is my message',
Expand Down Expand Up @@ -65,6 +67,6 @@ class NotificationNexmoChannelTestCustomFromNotification extends Notification
{
public function toNexmo($notifiable)
{
return (new NexmoMessage('this is my message'))->from('5554443333');
return (new NexmoMessage('this is my message'))->from('5554443333')->unicode();
}
}

0 comments on commit 3001640

Please sign in to comment.