laravel 5.3では、登録が成功するたびに通知を使用してメールを送信し、ユーザーに通知を保存します。私はToEmail、ToArrayを持つRegister拡張を作成しますNotification
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) 表Notifications( id、type、notifiable_id、notifiable_type、) しかし、登録時に、通知が表に挿入されずに電子メールのみが送信されますdata。read_at
アップデート
@ ありがとうございます
。メール通知は送信できますが、テーブルへの挿入はできないため、メソッドをABDEL-RHMANに設定します。解決策はありますか?ありがとうviareturn ['database','mail']