php - 从 Oracle 数据库向多个用户发送通知
问题描述
在 Laravel 中,我从 Oracle 数据库向用户发送电子邮件通知。与 Oracle 的连接正常,但尝试向用户发送电子邮件通知时出现以下错误:
调用 my_project/vendor /laravel/framework/src/Illuminate/Notifications/Channels/MailChannel.php 中未定义的方法 stdClass::routeNotificationFor()
我的通知类如下:
<?php
namespace App\Notifications;
use Illuminate\Notifications\Notifiable;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use App\User;
class Expired 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 ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->line('The introduction to the notification.')
->action('Notification Action', url('/'))
->line('Thank you for using our application!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}
这就是我发送通知的方式:
<?php
$end = Carbon::now()->addDays(15)->format('Y-m-d h:m:s');
$users = DB::select("select email from user_ where val_to >= '$end ' group by email ");
Notification::send($users, new Expired($users));
解决方案
推荐阅读
- javascript - 发送电子邮件和调用模式后,提交按钮需要永久禁用
- regex - 如何检查字符串是否包含在 RegExp 中传递的字符?
- event-sourcing - EventStore - 使用什么版本?
- python-3.x - 停止程序后是否有保留字/关键字继续?
- html - 即使正确的网格系统,Bootstrap4 列也会堆叠而不是并排放置
- javascript - javascript to typescript:混合基于原型的对象和基于类的对象
- apache-kafka - 在 Kafka 生产者上启用幂等性是否会降低吞吐量
- python - on_message 等待用户对消息做出反应或超时,然后机器人再次发送另一条带有反应的消息
- javascript - 在 JS 控制台中运行代码时收到错误消息
- javascript - 在 React JS 中动态选择状态对象名称