Number of days since the event
This commit is contained in:
1 parent
d4e5a2f181
commit
c2d9b451fd
10 files changed
+25
-15
No files matched your search
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Filament\Widgets\Data;
|
||||
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Models\StatistikoDetail;
|
||||
use App\Models\StatistikoPlayer;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class LoadPlayer
|
||||
{
|
||||
@@ -50,19 +50,20 @@ class LoadPlayer
|
||||
|
||||
$res = StatistikoPlayer::with('event')->where('ss_player_id', (int) $ss_player_id)->get();
|
||||
|
||||
$labels = [];
|
||||
$datasets = [];
|
||||
|
||||
$tmp = [];
|
||||
foreach ($res as $value) {
|
||||
|
||||
// dd($value);
|
||||
|
||||
$val = 0;
|
||||
$key = 0;
|
||||
|
||||
if (isset($value->event->starttime)) {
|
||||
|
||||
// $labels[] = $value->event->starttime->format('d.M.y');
|
||||
|
||||
$labels[] = round($value->event->starttime->diffInDays(Carbon::now()));
|
||||
$key = round($value->event->starttime->diffInDays(Carbon::now()));
|
||||
|
||||
switch ($statistic_type) {
|
||||
case 'gls':
|
||||
@@ -87,15 +88,24 @@ class LoadPlayer
|
||||
$val = (int) $value->shots_off_target;
|
||||
break;
|
||||
}
|
||||
|
||||
$tmp[$key] = $val;
|
||||
}
|
||||
$datasets[] = $val;
|
||||
}
|
||||
|
||||
ksort($tmp);
|
||||
$dataset = [];
|
||||
$labels = [];
|
||||
foreach ($tmp as $key => $value) {
|
||||
$labels[] = $key;
|
||||
$dataset[] = $value;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'datasets' => [
|
||||
[
|
||||
'label' => ucfirst($statistic_name),
|
||||
'data' => $datasets,
|
||||
'data' => $dataset,
|
||||
'tension' => 0.5,
|
||||
'borderColor' => '#36A2EB',
|
||||
'pointStyle' => $hasdots,
|
||||
|
||||
Reference in new issue
Block a user