【发布时间】:2021-07-27 09:40:42
【问题描述】:
我有 PurchaseOrderProduct 模型,我从中获取这样的数据
PurchaseOrderProduct::with('products')
->with('warehouse_locations')
->with('productStatuses')
->with('purchase_orders')
->where('product_id', $request->product_id)
->where('free_qty', '>=', 1)
->get();
现在在这个表中,我有 expiry_date 类型的列 date 我想获取最接近当前日期的数据 orderBy expiry_date。
意味着purchase_order_product的到期日期最接近当前日期。
【问题讨论】:
-
您的结果中是否需要过期产品或可以排除它们?
标签: laravel eloquent laravel-8 laravel-query-builder