name, 'b'); } foreach ($client->sport as $sport_id) { if ($debug) { Notice::note('Sport: '.$sport_id, 'b'); } $multilines = AlarmMultilineSetting::get($sport_id); foreach ($client->bookmaker as $client_bookmaker_id) { $alarm_threshold = AlarmSettings::get($client_bookmaker_id, $sport_id); $filter = AlarmBookmakerFilter::get($client_bookmaker_id, $sport_id); $res = EventBookmaker::with('event')->where('bookmaker_id', $client_bookmaker_id)->where('sport_id', $sport_id)->get(); // $res = EventBookmaker::with('event')->where('bookmaker_id', $client_bookmaker_id)->whereHas('event', function (Builder $query) { // $query->whereNotNull('starttime') // ->where('starttime', '>', now()); // })->get(); // $res = EventBookmaker::where('event_id', 14597944)->where('bookmaker_id', $client_bookmaker_id)->where('sport_id', $sport_id)->get(); foreach ($res as $event) { if ($event?->event?->starttime > now()) { foreach ($multilines as $multiline_id => $multiline) { $table = $multiline['table']; $odds = AlarmLoadOdds::get($event->event_id, $table, $oddnames[$table]); // check if margin is > 1 $compare_odds = AlarmFilterCompare::get($odds, $filter); // check if client has odds $client_odds = AlarmFilterClient::get($odds, $client_bookmaker_id); if (isset($oddnames[$table]) && isset($alarm_threshold[$multiline_id])) { AlarmStore::get($table, $event->event_id, $oddnames[$table], $client_bookmaker_id, $alarm_threshold[$multiline_id], $compare_odds, $client_odds); } } } } } } } } }