design changes to save space

This commit is contained in:
salam committed 2026-05-31 12:13:22 +02:00
1 parent 4b06f98bee
commit fcbf718492
10 files changed
+319 -304

No files matched your search

+41 -78
View File
@@ -28,6 +28,8 @@ class LoadPlayer
$end = $filter['end_date'] ?? 0;
$statistic_type = $filter['statistic_type'];
$team_position = $filter['team_position'];
if (! $league_id) {
@@ -40,101 +42,62 @@ class LoadPlayer
return [];
}
if ($statistic_type == 'none') {
$statistic_type = 'gls';
}
$player_name = StatistikoDetail::where('tm_player_id', (int) $tm_player_id)->value('name');
$res = StatistikoPlayer::with('event.home')->with('event.away')->where('tm_player_id', (int) $tm_player_id)->get();
$res = StatistikoPlayer::with('event')->where('tm_player_id', (int) $tm_player_id)->get();
$labels = [];
$playing_date = [];
$events = [];
$datasets_goals = [];
$datasets_fouls = [];
$datasets_offside = [];
$datasets_card = [];
$datasets_shots_on = [];
$datasets_shots_off = [];
$datasets = [];
foreach ($res as $value) {
// dd($value);
$val = 0;
if (isset($value->event->starttime)) {
// $labels[] = $value->event->starttime->format('d.M.y');
$labels[] = round($value->event->starttime->diffInDays(Carbon::now()));
$events[] = $value->event->home->name.' vs '.$value->event->away->name;
$playing_date[] = $value->event->starttime->format('d. F Y H:i');
$datasets_goals[] = (int) $value->goals;
$datasets_fouls[] = (int) $value->fouls;
$datasets_offside[] = (int) $value->offsides;
$datasets_card[] = (int) $value->card_yellow + $value->card_red + $value->card_yellowred;
$datasets_shots_on[] = (int) $value->shots_on_target;
$datasets_shots_off[] = (int) $value->shots_off_target;
switch ($statistic_type) {
case 'gls':
$val = (int) $value->goals;
break;
case 'crn':
$val = (int) 0;
break;
case 'fls':
$val = (int) $value->fouls;
break;
case 'ofs':
$val = (int) $value->offsides;
break;
case 'crd':
$val = (int) $value->card_yellow + $value->card_red + $value->card_yellowred;
break;
case 'snt':
$val = (int) $value->shots_on_target;
break;
case 'tsh':
$val = (int) $value->shots_off_target;
break;
}
}
$datasets[] = $val;
}
$data = [
'datasets' => [
[
'label' => 'Goals',
'data' => $datasets_goals,
'dates' => $playing_date,
'events' => $events,
'label' => ucfirst($team_position),
'data' => $datasets,
'tension' => 0.5,
'borderColor' => '#fb2c36',
'backgroundColor' => '#fb2c36',
],
[
'label' => 'Fouls Commited',
'data' => $datasets_fouls,
'dates' => $playing_date,
'events' => $events,
'tension' => 0.5,
'borderColor' => '#f0b100',
'backgroundColor' => '#f0b100',
'dates' => $playing_date,
'events' => $events,
],
[
'label' => 'Offside',
'data' => $datasets_offside,
'dates' => $playing_date,
'events' => $events,
'tension' => 0.5,
'borderColor' => '#7ccf00',
'backgroundColor' => '#7ccf00',
],
[
'label' => 'Cards',
'data' => $datasets_card,
'dates' => $playing_date,
'events' => $events,
'tension' => 0.5,
'borderColor' => '#00b8db',
'backgroundColor' => '#00b8db',
],
[
'label' => 'Shots On Target',
'data' => $datasets_shots_on,
'dates' => $playing_date,
'events' => $events,
'tension' => 0.5,
'borderColor' => '#615fff',
'backgroundColor' => '#615fff',
],
[
'label' => 'Shots Off Target',
'data' => $datasets_shots_off,
'dates' => $playing_date,
'events' => $events,
'tension' => 0.5,
'borderColor' => '#e12afb',
'backgroundColor' => '#e12afb',
'borderColor' => '#36A2EB',
],
],
'labels' => $labels,