1

I have an array $time_schedule_id= array(1,3,5). Now I want those data which are not matched with the given array ( $time_schedule_id= array(1,3,5) ) from $time_schedule_table.

DB::table('time_schedule_table')
select('*')
where('id','!=', ?)

How can I generate this query string to use with MySQL?

raff
  • 423
  • 4
  • 13
  • 28

1 Answers1

1

You can use laravel whereNotIn() eloquent function

DB::table('time_schedule_table')->select(*)->whereNotIn('id', [1,3,5])->get();

Ayaz Ali Shah
  • 3,453
  • 9
  • 36
  • 68