Notifications 将通知保存到laravel 5.3中的数据库中
在Laravel5.3中,每当成功注册时,我使用通知向用户发送邮件并保存通知。 我创建Notifications 将通知保存到laravel 5.3中的数据库中,notifications,laravel-5.3,laravel-notification,Notifications,Laravel 5.3,Laravel Notification,在Laravel5.3中,每当成功注册时,我使用通知向用户发送邮件并保存通知。 我创建注册扩展通知必须发送邮件,到阵列 public function toMail($notifiable){ return (new MailMessage) ->line('The introduction to the notification.') ->action('Notification Action', 'https:
注册
扩展通知
必须发送邮件,到阵列
public function toMail($notifiable){
return (new MailMessage)
->line('The introduction to the notification.')
->action('Notification Action', 'https://laravel.com'.print_r($notifiable, true))
->line('Thank you for using our application!');
}
public function toArray($notifiable){
return [
'data' => 'A new post was published on Laravel News.'
];
}
在模型使用中,我编写函数
public function routeNotificationForMail(){
return $this->email;
}
public function routeNotificationForDatabase(){
Log::info('run route database');
return $this;
}
说明表User
(id
,email
,password
)
表通知
(id
,类型
,应报告的id
,应报告的类型
,数据
,读取时间
)
但当注册时,我只发送电子邮件,而不向表中插入通知
更新
谢谢你@ABDEL-RHMAN
,但是我通过方法将设置为返回['database','mail']
因为我可以发送电子邮件通知,但不能插入到表中。
我有办法吗?谢谢大家您是否将通过方法设置为返回['database','mail']
您是否将通过方法设置为返回['database','mail']