我怎么说 WHERE (a = 1 OR b =1 ) AND (c = 1 OR d = 1)
WHERE (a = 1 OR b =1 ) AND (c = 1 OR d = 1)
对于更复杂的查询,我应该使用原始SQL吗?
利用参数分组(Laravel4.2)。以您的示例为例:
Model::where(function ($query) { $query->where('a', '=', 1) ->orWhere('b', '=', 1); })->where(function ($query) { $query->where('c', '=', 1) ->orWhere('d', '=', 1); });