【发布时间】:2016-04-08 07:38:59
【问题描述】:
我有一个使用这种设计的事务表:
|id|value|payed_out|...|created_at|updated_at
现在我想退回所有按日期排序且限制为 15 个的交易:
- not payed_out(表示 payed_out == null)
- 不早于 24 小时(表示从现在到“created_at”的时间戳为
查询可能类似于:
Transactions::where(payed_out, null)->where(?how to perform the not older check?) ->orderBy('created_at', 'desc') ->take(15)
->get();
我需要“扩展”上述查询的返回集合。
在我看来,我想显示交易“过期”之前的时间,这意味着我需要将一个字段“添加”到包含交易“created_at”字段中的“时间”的集合中。
希望你能理解我的需要。
【问题讨论】:
标签: sql eloquent laravel-5.1 where-clause