62 行
1.2 KiB
PHP
62 行
1.2 KiB
PHP
<?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;
|
|
private $token;
|
|
|
|
/**
|
|
* Create a new notification instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct($token)
|
|
{
|
|
$this->token = $token;
|
|
}
|
|
|
|
/**
|
|
* 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())
|
|
->content('認証トークンは '.$this->token.' です。')
|
|
->unicode();
|
|
}
|
|
|
|
/**
|
|
* Get the array representation of the notification.
|
|
*
|
|
* @param mixed $notifiable
|
|
* @return array
|
|
*/
|
|
public function toArray($notifiable)
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
}
|