Reputation: 4705
I'm sending an email to a seller informing him that the buyer is coming soon.
Mail::to($order->buyer)
->locale($order->buyer->privacy->language)
->later($when->addHour(), new ReminderForBuyer($order));
However, I have a problem that there are cases, where the buyer can cancel his already paid order.
So how can I prevent sending this email out?
Upvotes: 3
Views: 482
Reputation: 1012
You could change the structure, not delaying the email with later.
Just dispatch a new job ReminderForBuyerJob::dispatch($order)->delay($when->addHour())
.
ReminderForBuyerJob
will check if the order is canceled, if so dont send the ReminderForBuyer
.
Upvotes: 3