from = $from; $this->nexmo = $nexmo; } /** * Send the given notification. * * @param mixed $notifiable * @param \Illuminate\Notifications\Notification $notification * @return \Nexmo\Message\Message */ public function send($notifiable, Notification $notification) { if (! $to = $notifiable->routeNotificationFor('nexmo')) { return; } $message = $notification->toNexmo($notifiable); if (is_string($message)) { $message = new NexmoMessage($message); } return $this->nexmo->message()->send([ 'type' => $message->type, 'from' => $message->from ?: $this->from, 'to' => $to, 'text' => trim($message->content), ]); } }