Juliver Galleto
Juliver Galleto

Reputation: 9047

fetch record that is equal to 1 or 0 laravel eloqouent

I'm using this one

$notification = notification::where('department', '=', 1)->get();

to fetch all records that has 'department' of 1 in my database (it works)

Now, I want to fetch also all records that neither has 'department' of 1 or 0, any ideas, help?

Upvotes: 0

Views: 46

Answers (1)

manix
manix

Reputation: 14747

How about using whereIn or whereNotIn clauses?

$notification = notification::whereIn('department', [1, 2])->get();

Upvotes: 2

Related Questions