2021-10-29 17:51:41 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Notifications;
|
|
|
|
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Notifications\Messages\NexmoMessage;
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
|
|
|
|
class SmsNotification extends Notification
|
|
|
|
{
|
|
|
|
use Queueable;
|
2021-11-05 18:20:36 +09:00
|
|
|
private $message;
|
2021-10-29 17:51:41 +09:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new notification instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2021-11-05 18:20:36 +09:00
|
|
|
public function __construct($message)
|
2021-10-29 17:51:41 +09:00
|
|
|
{
|
2021-11-05 18:20:36 +09:00
|
|
|
$this->message = $message;
|
2021-10-29 17:51:41 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the notification's delivery channels.
|
|
|
|
*
|
|
|
|
* @param mixed $notifiable
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function via($notifiable)
|
|
|
|
{
|
|
|
|
return ['nexmo'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the Nexmo / SMS representation of the notification.
|
|
|
|
*
|
|
|
|
* @param mixed $notifiable
|
|
|
|
* @return NexmoMessage
|
|
|
|
*/
|
|
|
|
public function toNexmo($notifiable)
|
|
|
|
{
|
|
|
|
return (new NexmoMessage())
|
2021-11-05 18:20:36 +09:00
|
|
|
->content($this->message)
|
2021-10-29 17:51:41 +09:00
|
|
|
->unicode();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the array representation of the notification.
|
|
|
|
*
|
|
|
|
* @param mixed $notifiable
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function toArray($notifiable)
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
//
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|