This commit is contained in:
salam committed 2026-04-29 12:28:28 +02:00
1 parent d30eb76442
commit 01a3f41ec0
6 files changed
+210 -14

No files matched your search

+71
View File
@@ -0,0 +1,71 @@
<?php
namespace App\Actions\Statistics;
use App\Models\StatistikoEvent;
class EventData
{
public static function get($filter)
{
$league_id = (int) $filter['league_id'] ?? 0;
$team_id = (int) $filter['team_id'] ?? 0;
if (! $league_id) {
return [];
}
if (! $team_id) {
return [];
}
switch ($filter['team_position']) {
case 'home':
$res = StatistikoEvent::where('league_id', $league_id)->where('home_id', '=', $team_id)->get();
break;
case 'away':
$res = StatistikoEvent::where('league_id', $league_id)->where('away_id', '=', $team_id)->get();
break;
default:
$res = StatistikoEvent::where('league_id', $league_id)
->where(function ($query) use ($team_id) {
$query->where('home_id', '=', $team_id)->orWhere('away_id', '=', $team_id);
})->get();
break;
}
$datasets = [];
$labels = [];
foreach ($res as $value) {
$labels[] = $value['starttime']->format('d. M.y');
$tmp = [];
$tmp['crd_a'] = (int) $value['crd_a'];
$tmp['crd_h'] = (int) $value['crd_h'];
$tmp['crn_a'] = (int) $value['crn_a'];
$tmp['crn_h'] = (int) $value['crn_h'];
$tmp['fls_a'] = (int) $value['fls_a'];
$tmp['fls_h'] = (int) $value['fls_h'];
$tmp['gls_a'] = (int) $value['gls_a'];
$tmp['gls_h'] = (int) $value['gls_h'];
$tmp['ofs_a'] = (int) $value['ofs_a'];
$tmp['ofs_h'] = (int) $value['ofs_h'];
$tmp['snt_a'] = (int) $value['snt_a'];
$tmp['snt_h'] = (int) $value['snt_h'];
$tmp['tsh_a'] = (int) $value['tsh_a'];
$tmp['tsh_h'] = (int) $value['tsh_h'];
$tmp['exp_handicap'] = (float) $value['exp_handicap'];
$tmp['exp_total'] = (float) $value['exp_total'];
$tmp['exp_away'] = (float) $value['expgoalsaway_value'];
$tmp['exp_home'] = (float) $value['expgoalshome_value'];
$datasets[] = $tmp;
}
return ['lables' => $labels, 'datasets' => $datasets];
}
}
@@ -0,0 +1,44 @@
<?php
namespace App\Actions\Statistics;
class StatisticEvents
{
public static function load($filter)
{
$data = EventData::get($filter);
if (! $data) {
return [];
}
return [];
dd($data);
/*
"team_position" => "away"
"similar_past_matches" => "none"
"statistic_type" => "none"
"accuracy" => 0.5
"league_id" => "87"
"team_id" => null
"startDate" => null
"endDate" => null
"palyer_id" => null
'sport_id',
'league_id',
'home_id',
'away_id',
'starttime',
*/
// $res = StatistikoEvent::where('league_id', $league_id)->get();
// $result = DB::connection('mongodb')
// ->table('movies')
// ->where('league_id', $league_id)
// ->orWhere('home_id', $home_id)
// ->get();
}
}