condition for both of one should be true laravel eloquent

condition for both of one should be true laravel eloquent
WHERE age < 6 OR (age > 8 AND name IN ('Jane', 'Jerry'))

return \App\Dogs::select('name', 'age')
->where('age','<', 6)
->orWhere(function($q){
$q->where('age','>', 8);
$q->whereIn('name', ['Jane', 'Jerry']);
})
->get();

Leave a Comment