This commit is contained in:
salam committed 2026-10-04 15:25:03 +02:00
1 parent 9bcd4432c6
commit 6f92f9e1d5
1209 files changed
+220940

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
<?php
namespace App\Actions;
use App\Models\Event;
use App\Models\OddsTable;
use Carbon\Carbon;
class AlarmStatistic
{
public static function load()
{
$res = OddsTable::select('name', 'fieldnames')->get();
$fields = [];
foreach ($res as $value) {
$fields[$value->name] = explode(',', $value->fieldnames);
}
$events = Event::with('event_bookmaker')
->where('sport_id', auth()->user()->sport_id)
->where('starttime', '>=', Carbon::now())
->whereHas('event_bookmaker', function ($query) {
$query->where('bookmaker_id', auth()->user()->bookmaker_id);
})
->get();
$arr = [];
foreach ($events as $event) {
$row = $event->event_bookmaker;
// $row = get_object_vars($event->toArray());
foreach ($fields as $table => $names) {
foreach ($names as $name) {
$val = (int) $row[$name];
if ($val) {
if (isset($arr[$table][$val])) {
$arr[$table][$val]++;
} else {
$arr[$table][$val] = 1;
}
}
}
}
}
return $arr;
}
}