$oddname) { if ($client_odds[$oddname] == $favorit) { $threshold = $client_odds[$oddname] - $compare_odds[$oddname]; if ($threshold > $alarm_threshold[3]) { // ROT $update_array[$fieldname] = 3; } elseif ($threshold > $alarm_threshold[2]) { // ORANGE $update_array[$fieldname] = 2; } elseif ($threshold > $alarm_threshold[1]) { // GRÜNE $update_array[$fieldname] = 1; } else { // Reset Alarm $update_array[$fieldname] = 0; } } else { $update_array[$fieldname] = 0; } } EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $client_bookmaker_id)->update($update_array); } }