2

I am looking for laravel way for this query:

select * from `table` 
where (product_id, request_id) NOT IN ((66, 10),(76,23))

Perhaps something like:

$ids = =array(
    ['66', '10'],
    ['76', '23']
)
DB::table('table')->whereNotInMultiple(['product_id', 'request_id'], $ids)->get();

How do I do this in laravel?

Azima
  • 3,835
  • 15
  • 49
  • 95

1 Answers1

-1
DB::table('table')->whereNotIn('product_id', ['66','10'])
->whereNotIn('request_id', ['76', '23'])->get();
Sallmin Rexha
  • 125
  • 1
  • 11
  • This is not doing what the original SQL does. If there is a row of (product_id=66, request_id=1), it will still be in the result in the original SQL, but will be excluded using this code. – cytsunny May 07 '21 at 09:49