执行php artisan make:notification InvoicePaid
创建通知
public function via($notifiable)
{
$to = $notifiable->mobile;
$code = mt_rand(10000,99999);
$minutes = 5;
// 短信内容
$content = '【xx】亲爱的用户,您的验证码是' . $code . '。有效期为' . $minutes . '分钟,请尽快验证。';
// 只希望使用内容方式放送,可以不设置模板id和模板data(如:云片、luosimao)
dd(PhpSms::make()->to($to)->content($content)->send());
// return ['PhpSms'];
}
因为没有国内的短信发送包 所以把发短信代码写在via()方法里
使用通知:Notification::send($event,new SendSms($event));
近期评论