Ali Özen
Ali Özen

Reputation: 1609

Where condition when two column is not false same time

For example i have 2 column. status --> boolean allowed --> boolean

I am trying to get 1,0 - 0,1 - 1,1 How can i get collection when status is false and allowed is false.

$data = Data::whereNot('allowed', false)->whereNot('status', false)->get();

is return 1,1 condition as expected. Can we make this query in one row?

Upvotes: 0

Views: 219

Answers (1)

TsaiKoga
TsaiKoga

Reputation: 13394

Get one of them is true, or both are true:

$data = Data::where('allowed', true)->orWhere('status', true)->get();

Upvotes: 1

Related Questions