I want to update all model data except some from an array of ids, how is this kind of thing possible with eloquent?
What i'm doing:
Creating or updating events and setting availability to 0 also gatherings the ids in a foreach loop for each event
$rv = CalendarSchedule::updateOrCreate([
'date_start' => $import['start']->format('Y-m-d H:i:s'),
'date_end' => $import['end']->format('Y-m-d H:i:s'),
'operator_id' => $operator->id
],[
'location_id' => $operator->place_id,
'available' => 0,
'block' => 1
]);
array_push($ids, $rv->id);
Now when the foreach loop ends i want to update all the CalendarSchedule data except those in the ids array and set available => 1
Using made it work.
DB::table('calendar_schedules')->whereNotIn('id', $ids)->update([
'available' => 1
]);