statistico players wip
This commit is contained in:
1 parent
314ab7885b
commit
5010e7ac02
12 files changed
+75
-54
No files matched your search
@@ -0,0 +1,248 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets\Data;
|
||||
|
||||
use App\Models\StatisticFixtures;
|
||||
use App\Models\StatistikoEvent;
|
||||
use App\Models\StatistikoPlayer;
|
||||
|
||||
class EventsLoad
|
||||
{
|
||||
public static $last_query = [];
|
||||
|
||||
public static function load($filter)
|
||||
{
|
||||
// dd($filter);
|
||||
|
||||
$league_id = (int) $filter['league_id'] ?? 0;
|
||||
|
||||
$team_id = (int) $filter['team_id'] ?? 0;
|
||||
|
||||
$tm_player_id = (int) $filter['tm_player_id'] ?? 0;
|
||||
|
||||
if (! $league_id) {
|
||||
return [];
|
||||
}
|
||||
if (! $team_id) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$team_position = $filter['team_position'];
|
||||
|
||||
/**
|
||||
* ACCURACY DATA
|
||||
*/
|
||||
switch ($filter['team_position']) {
|
||||
case 'home':
|
||||
$res = StatisticFixtures::where('league_id', $league_id)->where('home_id', $team_id)->first();
|
||||
break;
|
||||
|
||||
case 'away':
|
||||
$res = StatisticFixtures::where('league_id', $league_id)->where('away_id', $team_id)->first();
|
||||
break;
|
||||
|
||||
default:
|
||||
$res = StatisticFixtures::where('league_id', $league_id)
|
||||
->where(function ($query) use ($team_id) {
|
||||
$query->where('home_id', '=', $team_id)->orWhere('away_id', '=', $team_id);
|
||||
})->first();
|
||||
break;
|
||||
}
|
||||
|
||||
$start = $filter['start_date'] ?? 0;
|
||||
|
||||
$end = $filter['end_date'] ?? 0;
|
||||
|
||||
$similar_past_matches = $filter['similar_past_matches'] ?? 0;
|
||||
|
||||
$statistic_type = $filter['statistic_type'] ?? 0;
|
||||
|
||||
/**
|
||||
* WITH PLAYER
|
||||
*/
|
||||
$tm_player_id = $filter['tm_player_id'];
|
||||
|
||||
if ($tm_player_id) {
|
||||
$matches_played = StatistikoPlayer::where('tm_player_id', (int) $tm_player_id)->pluck('match_id')->toArray();
|
||||
} else {
|
||||
$matches_played = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* STATTISTIC DATA
|
||||
*/
|
||||
switch ($filter['team_position']) {
|
||||
case 'home':
|
||||
$res = StatistikoEvent::where('league_id', $league_id)
|
||||
->where('home_id', '=', $team_id)
|
||||
->when($matches_played, function ($query) use ($matches_played) {
|
||||
return $query->whereIn('match_id', $matches_played);
|
||||
})->when($start, function ($query) use ($start) {
|
||||
return $query->where('starttime', '>=', $start);
|
||||
})->when($end, function ($query) use ($end) {
|
||||
return $query->where('starttime', '<=', $end);
|
||||
})
|
||||
->get();
|
||||
break;
|
||||
|
||||
case 'away':
|
||||
$res = StatistikoEvent::where('league_id', $league_id)
|
||||
->where('away_id', '=', $team_id)
|
||||
->when($matches_played, function ($query) use ($matches_played) {
|
||||
return $query->whereIn('match_id', $matches_played);
|
||||
})->when($start, function ($query) use ($start) {
|
||||
return $query->where('starttime', '>=', $start);
|
||||
})->when($end, function ($query) use ($end) {
|
||||
return $query->where('starttime', '<=', $end);
|
||||
})
|
||||
->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);
|
||||
})
|
||||
->when($matches_played, function ($query) use ($matches_played) {
|
||||
return $query->whereIn('match_id', $matches_played);
|
||||
})->when($start, function ($query) use ($start) {
|
||||
return $query->where('starttime', '>=', $start);
|
||||
})->when($end, function ($query) use ($end) {
|
||||
return $query->where('starttime', '<=', $end);
|
||||
})->get();
|
||||
break;
|
||||
}
|
||||
|
||||
$datasets = [];
|
||||
$labels = [];
|
||||
|
||||
if (! $statistic_type || $statistic_type == 'none') {
|
||||
$statistic_type = 'gls';
|
||||
}
|
||||
|
||||
foreach ($res as $value) {
|
||||
$labels[] = $value['starttime']->format('d.M.y');
|
||||
|
||||
if ($team_position == 'home') {
|
||||
|
||||
switch ($statistic_type) {
|
||||
case 'gls':
|
||||
$val = (int) $value['gls_h'];
|
||||
break;
|
||||
case 'crn':
|
||||
$val = (int) $value['crn_h'];
|
||||
break;
|
||||
case 'fls':
|
||||
$val = (int) $value['fls_h'];
|
||||
break;
|
||||
case 'ofs':
|
||||
$val = (int) $value['ofs_h'];
|
||||
break;
|
||||
case 'crd':
|
||||
$val = (int) $value['crd_h'];
|
||||
break;
|
||||
case 'snt':
|
||||
$val = (int) $value['snt_h'];
|
||||
break;
|
||||
case 'tsh':
|
||||
$val = (int) $value['tsh_h'];
|
||||
break;
|
||||
}
|
||||
} elseif ($team_position == 'away') {
|
||||
|
||||
switch ($statistic_type) {
|
||||
case 'gls':
|
||||
$val = (int) $value['gls_a'];
|
||||
break;
|
||||
case 'crn':
|
||||
$val = (int) $value['crn_a'];
|
||||
break;
|
||||
case 'fls':
|
||||
$val = (int) $value['fls_a'];
|
||||
break;
|
||||
case 'ofs':
|
||||
$val = (int) $value['ofs_a'];
|
||||
break;
|
||||
case 'crd':
|
||||
$val = (int) $value['crd_a'];
|
||||
break;
|
||||
case 'snt':
|
||||
$val = (int) $value['snt_a'];
|
||||
break;
|
||||
case 'tsh':
|
||||
$val = (int) $value['tsh_a'];
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
switch ($statistic_type) {
|
||||
case 'gls':
|
||||
if ($team_id == $value['home_id']) {
|
||||
$val = (int) $value['gls_a'];
|
||||
} else {
|
||||
$val = (int) $value['gls_h'];
|
||||
}
|
||||
break;
|
||||
case 'crn':
|
||||
if ($team_id == $value['home_id']) {
|
||||
$val = (int) $value['crn_a'];
|
||||
} else {
|
||||
$val = (int) $value['crn_h'];
|
||||
}
|
||||
break;
|
||||
case 'fls':
|
||||
if ($team_id == $value['home_id']) {
|
||||
$val = (int) $value['fls_a'];
|
||||
} else {
|
||||
$val = (int) $value['fls_h'];
|
||||
}
|
||||
break;
|
||||
case 'ofs':
|
||||
if ($team_id == $value['home_id']) {
|
||||
$val = (int) $value['ofs_a'];
|
||||
} else {
|
||||
$val = (int) $value['ofs_h'];
|
||||
}
|
||||
break;
|
||||
case 'crd':
|
||||
if ($team_id == $value['home_id']) {
|
||||
$val = (int) $value['crd_a'];
|
||||
} else {
|
||||
$val = (int) $value['crd_h'];
|
||||
}
|
||||
break;
|
||||
case 'snt':
|
||||
if ($team_id == $value['home_id']) {
|
||||
$val = (int) $value['snt_a'];
|
||||
} else {
|
||||
$val = (int) $value['snt_h'];
|
||||
}
|
||||
break;
|
||||
case 'tsh':
|
||||
if ($team_id == $value['home_id']) {
|
||||
$val = (int) $value['tsh_a'];
|
||||
} else {
|
||||
$val = (int) $value['tsh_h'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
$datasets[] = $val;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'datasets' => [
|
||||
[
|
||||
'label' => ucfirst($team_position),
|
||||
'data' => $datasets,
|
||||
'fill' => true,
|
||||
'tension' => 0.5,
|
||||
'borderColor' => '#36A2EB',
|
||||
],
|
||||
],
|
||||
'labels' => $labels,
|
||||
];
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,283 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets\Data;
|
||||
|
||||
use App\Models\StatisticFixtures;
|
||||
use App\Models\StatistikoEvent;
|
||||
use App\Models\StatistikoPlayer;
|
||||
|
||||
class EventsLoadAspGoal
|
||||
{
|
||||
public static function load($filter)
|
||||
{
|
||||
// dd($filter);
|
||||
|
||||
$league_id = (int) $filter['league_id'] ?? 0;
|
||||
|
||||
$team_id = (int) $filter['team_id'] ?? 0;
|
||||
|
||||
if (! $league_id) {
|
||||
return [];
|
||||
}
|
||||
if (! $team_id) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$team_position = $filter['team_position'];
|
||||
|
||||
/**
|
||||
* ACCURACY DATA
|
||||
*/
|
||||
switch ($filter['team_position']) {
|
||||
case 'home':
|
||||
$res = StatisticFixtures::where('league_id', $league_id)->where('home_id', $team_id)->first();
|
||||
break;
|
||||
|
||||
case 'away':
|
||||
$res = StatisticFixtures::where('league_id', $league_id)->where('away_id', $team_id)->first();
|
||||
break;
|
||||
|
||||
default:
|
||||
$res = StatisticFixtures::where('league_id', $league_id)
|
||||
->where(function ($query) use ($team_id) {
|
||||
$query->where('home_id', '=', $team_id)->orWhere('away_id', '=', $team_id);
|
||||
})->first();
|
||||
break;
|
||||
}
|
||||
|
||||
$start = $filter['start_date'] ?? 0;
|
||||
|
||||
$end = $filter['end_date'] ?? 0;
|
||||
|
||||
$accuracy = (float) $filter['accuracy'];
|
||||
|
||||
if ($res == null) {
|
||||
|
||||
$handicap_range = 0;
|
||||
|
||||
$total_range = 0;
|
||||
|
||||
} else {
|
||||
|
||||
$exp_handicap = $res['exp_away'] - $res['exp_home'];
|
||||
|
||||
$exp_total = $res['exp_away'] + $res['exp_home'];
|
||||
|
||||
$handicap_range = [$exp_handicap - $accuracy, $exp_handicap + $accuracy];
|
||||
|
||||
$total_range = [$exp_total - $accuracy, $exp_total + $accuracy];
|
||||
}
|
||||
|
||||
/**
|
||||
* WITH PLAYER
|
||||
*/
|
||||
$tm_player_id = $filter['tm_player_id'];
|
||||
|
||||
if ($tm_player_id) {
|
||||
$matches_played = StatistikoPlayer::where('tm_player_id', (int) $tm_player_id)->pluck('match_id')->toArray();
|
||||
} else {
|
||||
$matches_played = false;
|
||||
}
|
||||
|
||||
$similar_past_matches = $filter['similar_past_matches'] ?? 0;
|
||||
|
||||
switch ($similar_past_matches) {
|
||||
case 'league':
|
||||
$res = StatistikoEvent::when($league_id, function ($query) use ($league_id) {
|
||||
return $query->where('league_id', $league_id);
|
||||
})->when($matches_played, function ($query) use ($matches_played) {
|
||||
return $query->whereIn('match_id', $matches_played);
|
||||
})->when($handicap_range, function ($query) use ($handicap_range) {
|
||||
return $query->whereBetween('exp_handicap', $handicap_range);
|
||||
})->when($total_range, function ($query) use ($total_range) {
|
||||
return $query->whereBetween('exp_total', $total_range);
|
||||
})->when($start, function ($query) use ($start) {
|
||||
return $query->where('starttime', '>=', $start);
|
||||
})->when($end, function ($query) use ($end) {
|
||||
return $query->where('starttime', '<=', $end);
|
||||
})
|
||||
->get();
|
||||
|
||||
break;
|
||||
case 'all':
|
||||
$res = StatistikoEvent::when($handicap_range, function ($query) use ($handicap_range) {
|
||||
return $query->whereBetween('exp_handicap', $handicap_range);
|
||||
})->when($matches_played, function ($query) use ($matches_played) {
|
||||
return $query->whereIn('match_id', $matches_played);
|
||||
})->when($total_range, function ($query) use ($total_range) {
|
||||
return $query->whereBetween('exp_total', $total_range);
|
||||
})->when($start, function ($query) use ($start) {
|
||||
return $query->where('starttime', '>=', $start);
|
||||
})->when($end, function ($query) use ($end) {
|
||||
return $query->where('starttime', '<=', $end);
|
||||
})
|
||||
->get();
|
||||
|
||||
break;
|
||||
// case 'none':
|
||||
// $res = StatistikoEvent::when($league_id, function ($query) use ($league_id) {
|
||||
// return $query->where('league_id', $league_id);
|
||||
// })->when($team_id, function ($query) use ($team_id, $team_position) {
|
||||
// switch ($team_position) {
|
||||
// case 'home':
|
||||
// return $query->where('home_id', $team_id);
|
||||
// break;
|
||||
// case 'away':
|
||||
// return $query->where('away_id', $team_id);
|
||||
// break;
|
||||
// default:
|
||||
// return $query->where('home_id', '=', $team_id)->orWhere('away_id', '=', $team_id);
|
||||
// break;
|
||||
// }
|
||||
// })->when($start, function ($query) use ($start) {
|
||||
// return $query->where('starttime', '>=', $start);
|
||||
// })->when($end, function ($query) use ($end) {
|
||||
// return $query->where('starttime', '<=', $end);
|
||||
// })
|
||||
// ->get();
|
||||
|
||||
// break;
|
||||
}
|
||||
|
||||
$datasets = [];
|
||||
$labels = [];
|
||||
|
||||
$statistic_type = $filter['statistic_type'];
|
||||
if (! $statistic_type || $statistic_type == 'none') {
|
||||
$statistic_type = 'gls';
|
||||
}
|
||||
|
||||
foreach ($res as $value) {
|
||||
$labels[] = $value['starttime']->format('d.M.y');
|
||||
|
||||
// dd($filter);
|
||||
|
||||
// $tmp['exp_handicap'] = (float) $value['exp_handicap'];
|
||||
// $tmp['exp_total'] = (float) $value['exp_total'];
|
||||
// $tmp['exp_away'] = (float) $value['exp_away'];
|
||||
// $tmp['exp_home'] = (float) $value['exp_home'];
|
||||
|
||||
if ($team_position == 'home') {
|
||||
|
||||
switch ($statistic_type) {
|
||||
case 'gls':
|
||||
$val = (int) $value['gls_h'];
|
||||
break;
|
||||
case 'crn':
|
||||
$val = (int) $value['crn_h'];
|
||||
break;
|
||||
case 'fls':
|
||||
$val = (int) $value['fls_h'];
|
||||
break;
|
||||
case 'ofs':
|
||||
$val = (int) $value['ofs_h'];
|
||||
break;
|
||||
case 'crd':
|
||||
$val = (int) $value['crd_h'];
|
||||
break;
|
||||
case 'snt':
|
||||
$val = (int) $value['snt_h'];
|
||||
break;
|
||||
case 'tsh':
|
||||
$val = (int) $value['tsh_h'];
|
||||
break;
|
||||
}
|
||||
} elseif ($team_position == 'away') {
|
||||
|
||||
switch ($statistic_type) {
|
||||
case 'gls':
|
||||
$val = (int) $value['gls_a'];
|
||||
break;
|
||||
case 'crn':
|
||||
$val = (int) $value['crn_a'];
|
||||
break;
|
||||
case 'fls':
|
||||
$val = (int) $value['fls_a'];
|
||||
break;
|
||||
case 'ofs':
|
||||
$val = (int) $value['ofs_a'];
|
||||
break;
|
||||
case 'crd':
|
||||
$val = (int) $value['crd_a'];
|
||||
break;
|
||||
case 'snt':
|
||||
$val = (int) $value['snt_a'];
|
||||
break;
|
||||
case 'tsh':
|
||||
$val = (int) $value['tsh_a'];
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
switch ($statistic_type) {
|
||||
case 'gls':
|
||||
if ($team_id == $value['home_id']) {
|
||||
$val = (int) $value['gls_a'];
|
||||
} else {
|
||||
$val = (int) $value['gls_h'];
|
||||
}
|
||||
break;
|
||||
case 'crn':
|
||||
if ($team_id == $value['home_id']) {
|
||||
$val = (int) $value['crn_a'];
|
||||
} else {
|
||||
$val = (int) $value['crn_h'];
|
||||
}
|
||||
break;
|
||||
case 'fls':
|
||||
if ($team_id == $value['home_id']) {
|
||||
$val = (int) $value['fls_a'];
|
||||
} else {
|
||||
$val = (int) $value['fls_h'];
|
||||
}
|
||||
break;
|
||||
case 'ofs':
|
||||
if ($team_id == $value['home_id']) {
|
||||
$val = (int) $value['ofs_a'];
|
||||
} else {
|
||||
$val = (int) $value['ofs_h'];
|
||||
}
|
||||
break;
|
||||
case 'crd':
|
||||
if ($team_id == $value['home_id']) {
|
||||
$val = (int) $value['crd_a'];
|
||||
} else {
|
||||
$val = (int) $value['crd_h'];
|
||||
}
|
||||
break;
|
||||
case 'snt':
|
||||
if ($team_id == $value['home_id']) {
|
||||
$val = (int) $value['snt_a'];
|
||||
} else {
|
||||
$val = (int) $value['snt_h'];
|
||||
}
|
||||
break;
|
||||
case 'tsh':
|
||||
if ($team_id == $value['home_id']) {
|
||||
$val = (int) $value['tsh_a'];
|
||||
} else {
|
||||
$val = (int) $value['tsh_h'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$datasets[] = $val;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'datasets' => [
|
||||
[
|
||||
'label' => ucfirst($team_position),
|
||||
'data' => $datasets,
|
||||
'fill' => true,
|
||||
'tension' => 0.5,
|
||||
'borderColor' => '#36A2EB',
|
||||
],
|
||||
],
|
||||
'labels' => $labels,
|
||||
];
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets\Data;
|
||||
|
||||
class HelperMoveingAverage
|
||||
{
|
||||
public static function get(&$data)
|
||||
{
|
||||
|
||||
$arr = $data['datasets'][0]['data'];
|
||||
|
||||
$new = [];
|
||||
$last = count($arr);
|
||||
foreach ($arr as $key => $value) {
|
||||
switch ($key) {
|
||||
case 0:
|
||||
$new[] = $value;
|
||||
break;
|
||||
case $last:
|
||||
$new[] = $arr[$last];
|
||||
break;
|
||||
default:
|
||||
$before = $key--;
|
||||
$after = $key++;
|
||||
$new[] = ($arr[$before] + $value + $arr[$after]) / 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$data['datasets'][0]['borderColor'] = '#00a63e';
|
||||
$data['datasets'][0]['data'] = $new;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets\Data;
|
||||
|
||||
class HelperStatisticType
|
||||
{
|
||||
protected static array $types = [
|
||||
'gls' => 'Goals',
|
||||
'crn' => 'Corner',
|
||||
'fls' => 'Fouls commited',
|
||||
'ofs' => 'Offside',
|
||||
'crd' => 'Cards',
|
||||
'snt' => 'Shot on target',
|
||||
'tsh' => 'Total shots',
|
||||
];
|
||||
|
||||
public static function get($filter): string
|
||||
{
|
||||
|
||||
$tmp = $filter['statistic_type'] ?? 'none';
|
||||
|
||||
if (isset(self::$types[$tmp])) {
|
||||
return self::$types[$tmp];
|
||||
}
|
||||
|
||||
return 'Goals';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets\Data;
|
||||
|
||||
use App\Models\StatistikoPlayer;
|
||||
|
||||
class PlayerLoad
|
||||
{
|
||||
public static function load($filter)
|
||||
{
|
||||
// dd($filter);
|
||||
|
||||
// "team_position" => "all"
|
||||
// "statistic_type" => "gls"
|
||||
// "similar_past_matches" => "none"
|
||||
// "accuracy" => "0.5"
|
||||
// "player_on_field" => "all"
|
||||
// "league_id" => "26"
|
||||
// "team_id" => "571991"
|
||||
// "start_date" => null
|
||||
// "end_date" => null
|
||||
// "tm_player_id" => null
|
||||
|
||||
// 'gls' => 'Goals', // goals
|
||||
// 'crn' => 'Corner',
|
||||
// 'fls' => 'Fouls commited', // fouls
|
||||
// 'ofs' => 'Offside', // offsides
|
||||
// 'crd' => 'Cards',
|
||||
// 'snt' => 'Shot on target', // shots_on_target
|
||||
// 'tsh' => 'Total shots', // shots_off_target
|
||||
|
||||
$league_id = (int) $filter['league_id'] ?? 0;
|
||||
|
||||
$team_id = (int) $filter['team_id'] ?? 0;
|
||||
|
||||
$tm_player_id = (int) $filter['tm_player_id'] ?? 0;
|
||||
|
||||
if (! $league_id) {
|
||||
return [];
|
||||
}
|
||||
if (! $team_id) {
|
||||
return [];
|
||||
}
|
||||
if (! $tm_player_id) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$team_position = $filter['team_position'];
|
||||
|
||||
$player_on_field = $filter['player_on_field'];
|
||||
|
||||
$res = StatistikoPlayer::with('event')->where('tm_player_id', $tm_player_id)
|
||||
->when($team_position, function ($query) use ($team_id, $team_position) {
|
||||
/**
|
||||
* TEAM HOME/AWAY
|
||||
*/
|
||||
switch ($team_position) {
|
||||
case 'home':
|
||||
return $query->where('activeteam_id', $team_id);
|
||||
break;
|
||||
|
||||
case 'away':
|
||||
return $query->where('activeteam_id', '!=', $team_id);
|
||||
break;
|
||||
}
|
||||
})->when($player_on_field, function ($query) use ($player_on_field) {
|
||||
/**
|
||||
* LINEUP
|
||||
*/
|
||||
switch ($player_on_field) {
|
||||
case 'lineup':
|
||||
return $query->where('lineup', 'T');
|
||||
break;
|
||||
case 'substituted':
|
||||
return $query->where('lineup', 'P');
|
||||
break;
|
||||
}
|
||||
|
||||
})->get();
|
||||
|
||||
$statistic_type = $filter['statistic_type'] ?? 0;
|
||||
|
||||
// $fields = 'goals,fouls,offsides,shots_on_target,shots_off_target, subtype_event_during_the_match';
|
||||
|
||||
$labels = [];
|
||||
$datasets = [];
|
||||
foreach ($res as $key => $value) {
|
||||
|
||||
$val = 0;
|
||||
|
||||
if (isset($value->event->starttime)) {
|
||||
|
||||
$labels[] = $value->event->starttime->format('d.M.y');
|
||||
|
||||
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' => ucfirst($team_position),
|
||||
'data' => $datasets,
|
||||
'fill' => true,
|
||||
'tension' => 0.5,
|
||||
'borderColor' => '#36A2EB',
|
||||
],
|
||||
],
|
||||
'labels' => $labels,
|
||||
];
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user