我在 laravel orm 中查询后有更改。但这不是工作。
在 SQL 中
select * from `promotions` join items on items.id = promotions.item_id where promotions.start >= "2014-12-30" and promotions.end <="2015-01-30"
在奥尔姆
$result = Promotion::whereNull('promotions.deleted_at')
->select('promotions.*','items.name as i_name')
->join('items', 'items.id', '=', 'promotions.item_id')
->where('start', '>=', $start || 'end', '<=', $end)
->get();
链接两个where
调用:
->where('start', '>=', $start)
->where('end', '<=', $end)
或者使用 whereBetween
.