所以我试图只抓取过去24小时,1周,1个月的数据。我有工作代码,但如果我正确地得到它,这是“其他方式”。我的意思是,如果日期现在是2016年11月30日,而我将数据值设置为2016年12月1日,那么24小时仍然会抓取信息,但不应该。如果日期为2016年11月30日,而我将其设置为2016年11月28日,那么24小时不能获取。对我来说这听起来像是倒退了。我希望这个解释是可以理解的。Laravel - 获取过去24小时,1周或1个月的数据
$getItemsOneDay = Deposit::where('steam_user_id',0)->where('status', Deposit::STATUS_ACTIVE)->where('created_at', '>', Carbon::now()->subMinutes(1440))->get();
$getItemsOneWeek = Deposit::where('steam_user_id',0)->where('status', Deposit::STATUS_ACTIVE)->where('created_at', '>', Carbon::now()->subMinutes(10080))->get();
$getItemsOneMonth = Deposit::where('steam_user_id',0)->where('status', Deposit::STATUS_ACTIVE)->where('created_at', '>', Carbon::now()->subMinutes(43200))->get();