Laravel carbon 检查是否从 table 过去
Laravel carbon check if past date from table
所以我想从我的 API 获取过去日期时间的数据,但是当我尝试这段代码时.. 看起来我得到的数据只有过去的日期不包括时间
$id_merchant = $request->input('id_merchant');
$Promotion = DB::table('promotion')
->leftJoin('product', 'product.id', '=', 'promotion.id_product')
->where('promotion.id_merchant', '=', $id_merchant)
->whereDate('end_time','>=', Carbon::now())
->select('promotion.*','product.product_name','product.price','product.stock')
->get();
我看到有人用
解决了这个问题
$end_time->isPast() function
但我不知道如何在我的案例中实现这一点。
对不起我的英语
->where('end_time', '>=', Carbon::now())
(whereDate过滤时间)
所以我想从我的 API 获取过去日期时间的数据,但是当我尝试这段代码时.. 看起来我得到的数据只有过去的日期不包括时间
$id_merchant = $request->input('id_merchant');
$Promotion = DB::table('promotion')
->leftJoin('product', 'product.id', '=', 'promotion.id_product')
->where('promotion.id_merchant', '=', $id_merchant)
->whereDate('end_time','>=', Carbon::now())
->select('promotion.*','product.product_name','product.price','product.stock')
->get();
我看到有人用
解决了这个问题$end_time->isPast() function
但我不知道如何在我的案例中实现这一点。 对不起我的英语
->where('end_time', '>=', Carbon::now())
(whereDate过滤时间)