Reputation: 811
I have change following my query in laravel orm. But it's not work.
in sql
select * from `promotions` join items on items.id = promotions.item_id where promotions.start >= "2014-12-30" and promotions.end <="2015-01-30"
in orm
$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();
Upvotes: 0
Views: 90
Reputation: 219930
Chain two where
calls:
->where('start', '>=', $start)
->where('end', '<=', $end)
Or use whereBetween
.
Upvotes: 2