whereBetween Dates in laravel 4 eloquent

2021-12-26 00:00:00 php laravel laravel-4 eloquent

我有一个这样的查询

SELECT * FROM `sp_price` WHERE (`from_date` between '2014-08-15' and '2014-09-18') || (`to_date` between '2014-08-15' and '2014-09-18')

现在我如何在 laravel 4 中转换这个查询.我使用 Eloquent

Now how I can convert this query in laravel 4. I use Eloquent

推荐答案

DB::table(sp_price)
     ->whereBetween('from_date',array('2014-08-15','2014-08-18'))
     ->orWhereBetween('to_date',array('2014-08-15','2014-08-15'))
     ->get();

也许你可以试试这个

相关文章