【发布时间】:2014-09-26 18:47:12
【问题描述】:
我有以下sql
select * from bids where deleted_at is null
and publication_date <= now() and open_date >= now()
我想用 ORM 来写
$bids = Bid::where('publication_date','<=','now()')->where('open_date','>=','now()')->get();
它不工作,然后我重写如下
$bids=DB::select(DB::raw('select * from bids where deleted_at is null and publication_date <= now() and open_date >= now()'));
如何在 ORM 上编写上述查询,
我认为now() 有问题
【问题讨论】:
标签: php mysql laravel laravel-4 eloquent