add groups and major groups direct from txodds for auto mapping names

This commit is contained in:
salam committed 2026-02-25 19:50:40 +01:00
1 parent ba83e1a12d
commit 859038cc8c
21 files changed
+299 -40

No files matched your search

@@ -0,0 +1,28 @@
<?php
namespace App\Console\Commands\DbMapper\Helper;
use App\Models\CompetitionGroup;
use App\Models\CompetitionGroupProvider;
class FindCompetitionGroup
{
public static function run(&$mapper)
{
if (isset($mapper['group_id'])) {
$mapper['txodds_group_id'] = CompetitionGroupProvider::where('provider_id', $mapper['provider_id'])
->where('provider_group_id', $mapper['group_id'])->value('competition_group_id');
}
if (! $mapper['txodds_group_id']) {
$arr = ExplodeString::grap($mapper['group']);
$mapper['txodds_group_id'] = CompetitionGroup::where('sport_id', $mapper['sport_id'])
->where(function ($query) use ($arr) {
foreach ($arr as $str) {
$query->where('name', 'like', '%'.$str.'%');
}
})->value('id');
}
}
}