1 回答

TA貢獻1868條經驗 獲得超4個贊
您的腳本中只有一些小問題:
在此處將逗號更改為點:
->line('You have a new subscriber:', $subscribers)
獲取對象的電子郵件屬性。像這樣:
$subscribers->email;
如果你想獲得最新的訂閱者(并且你的表包含 Laravel 時間戳)
Subscribe::where('email', '!=', null)->orderBy('created_at','DESC')->first();
總而言之,您的代碼應該如下所示:
public function toMail($notifiable)
{
$subscribers = Subscribe::where('email', '!=', null)->orderBy('created_at','DESC')->first();
return (new MailMessage)
->subject('You have a new subscriber')
->line('You have a new subscriber:'.$subscribers->email)
->action('Click Here', url('/subscribe'));
// ->line('Thank you for using our application!');
}
- 1 回答
- 0 關注
- 231 瀏覽
添加回答
舉報