我想有這種查詢雄辯:如何結合WHERE子句中雄辯
SELECT * FROM table WHERE status = 1 AND (type = 2 OR type = 3 OR type = 4)
我一直沒能找到雄辯這樣做的一個簡單的方法。如果我使用
Table::where('status', 1)->orWhere('type', 2)->orWhere('type', 3)...
這這相當於:
SELECT * FROM table WHERE status = 1 OR type = 2 OR type = 3 OR type = 4
這不是我所需要的。爲'status = 1'創建一個查詢範圍也會得到相同的結果。我如何在Eloquent中運行這個查詢?