0
我有一個名爲Quote
的模型,它具有$this->belongsTo(User::class)
關係。發送通知給與對象集合相關的用戶
我想要的是查詢某些行情(Where status = 3),然後將通知發送給這些報價的用戶。
例子。
$quotes = Quote::where('status', 3)->get();
Notification::send($quotes, new RequestClientReviewNotify($quotes));
但上面不會工作,因爲它會嘗試找到quotes
表email
場。
任何幫助將是偉大的!
有趣的解決方案 - 我不知道是否會總是渴望負荷只訪問引用集合時,用戶關係。 – Andrew
@Andrew append數組中的所有內容都將被加載 –
這可能不是最好的,因爲有時候我只想查詢行情並且沒有額外的用戶關係查詢。 – Andrew