mapping search wip (stuck)

This commit is contained in:
salam committed 2025-12-29 15:32:24 +01:00
1 parent ea91af51fa
commit b475d78f43
14 files changed
+126 -33

No files matched your search

@@ -4,6 +4,7 @@ namespace App\Console\Commands\Grapper\Betsapi;
use App\Console\Commands\Curl;
use App\Console\Commands\Nuh;
use App\Models\Event;
use App\Models\Mapper;
use App\Models\Sport;
use App\Utilities\Notice;
@@ -33,7 +34,7 @@ class Fixtures
$total = 1;
foreach ($sportmap as $sport_id => $betsapi_sport_id) {
$sport_url = str_replace('###sport_id###', $sport_id, $base_url);
$sport_url = str_replace('###sport_id###', $betsapi_sport_id, $base_url);
$page = 1;
while ($page <= $total) {
@@ -71,8 +72,13 @@ class Fixtures
'group_id' => (int) $row['league']['id'] ?? 0,
'group_cc' => strtoupper($row['league']['cc']) ?? '',
];
Mapper::updateOrCreate(['event_id' => (int) $row['id']], $event);
$event_id = (int) $row['id'];
$match_id = Event::where('betsapi_id', $event_id)->value('id');
if ($match_id) {
Mapper::where('event_id', $event_id)->delete();
} else {
Mapper::updateOrCreate(['event_id' => $event_id], $event);
}
}
}
}