mapper wip

This commit is contained in:
salam committed 2026-01-16 16:23:17 +01:00
1 parent 7b2894682f
commit 93febce6fb
18 files changed
+45151 -63

No files matched your search

@@ -0,0 +1,66 @@
<?php
namespace App\Console\Commands\Services\Tasks;
use App\Console\Commands\Nuh;
use App\Console\Commands\Services\Tasks\Helper\FindCountry;
use App\Console\Commands\Services\Tasks\Helper\FindElement;
use App\Console\Commands\Services\Tasks\Helper\FindGroup;
use App\Models\Event;
use App\Models\Mapper;
use App\Utilities\Notice;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
class DBMapper
{
public static function run()
{
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('MAPPER SOCCER', 'g');
}
$events = Mapper::get()->toArray();
$i = 0;
foreach ($events as $event) {
Notice::note($i);
FindElement::run($event);
FindGroup::run($event);
FindCountry::run($event);
// print_r($event);
if ($event['txodds_home_id'] && $event['txodds_away_id'] && $event['txodds_group_id']) {
$from = Carbon::createFromDate($event['starttime'])->subDay();
$to = Carbon::createFromDate($event['starttime'])->addDay();
// DB::enableQueryLog();
$query = Event::where('starttime', '>', $from->toDateTimeString())
->where('starttime', '<', $to->toDateTimeString())
->whereIn('home_id', $event['txodds_home_id'])
->whereIn('home_id', $event['txodds_away_id'])
->whereIn('competition_group_id', $event['txodds_group_id'])
->get();
// Notice::db(DB::getQueryLog());
Notice::db($query);
}
$i++;
if ($i > 100) {
exit;
}
}
}
}