【发布时间】:2017-09-13 22:20:53
【问题描述】:
在我的应用程序中,我必须检查某个日期是否已过期,因此必须发送电子邮件。日期保存在Clients 表中。如何在检索日期上添加 5 天,以便检查它是否会在 5 天内过期?我到现在为止的功能。
public function handle() {
$users =\App\Client::select('subscription_ends_at')
->groupBy('subscription_ends_at')
->get();
$data_now = Carbon::now();
foreach($date_expired as $users ){
// $date_expired + 5 days
if($date_expired > $data_now){
//Send e-mail
}
}
}
【问题讨论】: