2017-05-11 22 views
1

我有一個數據表與幾個狀態條件。例如:
status = "pending","approved","rejected"Laravel雄辯選擇數據只有特定的術語

如何使用雄辯查詢來選擇狀態爲「正在等待」,「已拒絕」的列?

+0

http://stackoverflow.com/questions/19325312/how-以創建 - 多where子句的查詢,使用-laravel,雄辯 – victor

回答

1

如果您需要選擇其中的狀態爲pendningrejected數據,使用whereIn()

Model::whereIn('status', ['pending', 'rejected'])->get(); 

或者orWhere()

Model::where('status', 'pending')->orWhere('status', 'rejected')->get();