You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.1 KiB
59 lines
1.1 KiB
<?php
|
|
/**
|
|
* 短信通知
|
|
*/
|
|
|
|
namespace App\Notifications;
|
|
|
|
use App\Channels\SmsChannel;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class SmsNotify extends Notification
|
|
{
|
|
use Queueable;
|
|
|
|
/**
|
|
* Create a new notification instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Get the notification's delivery channels.
|
|
*
|
|
* @param mixed $notifiable
|
|
* @return array
|
|
*/
|
|
public function via($notifiable)
|
|
{
|
|
return [SmsChannel::class, 'database'];
|
|
}
|
|
|
|
|
|
public function toSms($notifiable)
|
|
{
|
|
return sms($notifiable->mobile, $notifiable->sms_template, $notifiable->sms_code);
|
|
}
|
|
|
|
/**
|
|
* Get the array representation of the notification.
|
|
*
|
|
* @param mixed $notifiable
|
|
* @return array
|
|
*/
|
|
public function toArray($notifiable)
|
|
{
|
|
return [
|
|
'mobile' => $notifiable->mobile,
|
|
'sms_template' => $notifiable->sms_template,
|
|
'sms_code' => $notifiable->sms_code
|
|
];
|
|
}
|
|
|
|
}
|