From ecf5e6ef767b5c0633dbf70d83003f69d9428986 Mon Sep 17 00:00:00 2001 From: "Daniel S. Billing" Date: Tue, 31 Jan 2023 21:36:16 +0100 Subject: [PATCH 01/37] Added stats to user profile --- app/Models/GameSave.php | 19 +++++++++++++++++++ resources/views/member/show.blade.php | 17 ++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/app/Models/GameSave.php b/app/Models/GameSave.php index 085c10b41..49dd2b1d1 100644 --- a/app/Models/GameSave.php +++ b/app/Models/GameSave.php @@ -126,4 +126,23 @@ public function getCaughtPokemon() return $caughtPokemon; } + + // Get statistics + public function getStatistics(): array + { + $statistics = $this->statistics; + $statistics = explode("\r\n", $statistics); + $statistics = array_filter($statistics); + return array_map(function ($item) { + $item = explode(',', $item); + $name = str_replace('{', '', $item[0]); + // Remove [ and ] and some random number between from the name + $name = preg_replace('/\[[0-9]+\]/', '', $name); + + return [ + 'name' => $name, + 'value' => $item[1], + ]; + }, $statistics); + } } diff --git a/resources/views/member/show.blade.php b/resources/views/member/show.blade.php index a409934eb..22afab480 100644 --- a/resources/views/member/show.blade.php +++ b/resources/views/member/show.blade.php @@ -131,12 +131,10 @@
{{ trans('Game Save') }}
- @empty($user->gamejolt || $user->gamesave) -

{{ trans('User has not connected their Game Jolt account yet') }}

- @endempty @if($user->gamejolt and $user->gamesave)