【发布时间】:2017-03-30 06:49:21
【问题描述】:
我很困惑,真的不知道我应该如何以及在哪里选择两者中的一个?
我阅读了两者的文档
https://laravel.com/docs/5.4/queries#where-clauses
还有
https://laravel.com/docs/5.4/queries#raw-expressions
如果我使用类似这样的查询它不起作用
DB::table('table_name')
->where('parent_id', $parent_id)
->whereRaw("date",">",$date)
->get();
但它有效
DB::table('table_name')
->where('parent_id', $parent_id)
->where(DB::raw("date",">",$date))
->get();
【问题讨论】: