diff --git a/app/Filament/Widgets/PlayerPropsDrop.php b/app/Filament/Widgets/PlayerPropsDrop.php index f9977c9f..1ef34cf7 100644 --- a/app/Filament/Widgets/PlayerPropsDrop.php +++ b/app/Filament/Widgets/PlayerPropsDrop.php @@ -349,7 +349,7 @@ class PlayerPropsDrop extends Widget $count_player = 0; foreach ($player_totals as $key => $value) { - if ($value->details->position != 'GK' && (int) $value->details->is_active != 0) { + if (isset($value->details) && $value->details->position != 'GK' && (int) $value->details->is_active != 0) { $count_player++; } } diff --git a/app/Livewire/PlayerCalculator.php b/app/Livewire/PlayerCalculator.php index 8a28c7dc..21750e00 100644 --- a/app/Livewire/PlayerCalculator.php +++ b/app/Livewire/PlayerCalculator.php @@ -16,64 +16,66 @@ class PlayerCalculator extends Component $result = []; foreach ($player as $val) { + if ($val->details && $val->details->is_active) { - $tmp = []; - $tmp['id'] = $val->ss_player_id; - if (! isset($val->details)) { - $tmp['name'] = $val->ss_player_id; - $tmp['pos_ori'] = 'GK'; - $tmp['foot'] = 'Both'; - } else { - $tmp['name'] = $val->details->player_name; - $tmp['pos_ori'] = $val->details->position; - $tmp['foot'] = $val->details->preferred_foot; - } - $tmp['pos'] = ''; - $tmp['active'] = 0; - $tmp['tot_evt'] = $val->total_events; - $tmp['tot_min'] = $val->total_min; - $tmp['ave_min'] = $val->average_min; - $tmp['gls'] = $val->goals; - $tmp['fls'] = $val->fouls; - $tmp['ofs'] = $val->offsides; - $tmp['crd'] = $val->cards; - $tmp['snt'] = $val->shots_on_target; - $tmp['tsh'] = $val->shots_off_target; - - $level = round($val->total_events / 3); - if ($val->total_events) { - if ($level > 1 && $val->total_events < $level) { - $tmp['color_evt'] = 'danger'; - } elseif ($val->total_events < $level * 2) { - $tmp['color_evt'] = 'info'; + $tmp = []; + $tmp['id'] = $val->ss_player_id; + if (! isset($val->details)) { + $tmp['name'] = $val->ss_player_id; + $tmp['pos_ori'] = 'GK'; + $tmp['foot'] = 'Both'; } else { - $tmp['color_evt'] = 'success'; + $tmp['name'] = $val->details->player_name; + $tmp['pos_ori'] = $val->details->position; + $tmp['foot'] = $val->details->preferred_foot; } - } + $tmp['pos'] = ''; + $tmp['active'] = 0; + $tmp['tot_evt'] = $val->total_events; + $tmp['tot_min'] = $val->total_min; + $tmp['ave_min'] = $val->average_min; + $tmp['gls'] = $val->goals; + $tmp['fls'] = $val->fouls; + $tmp['ofs'] = $val->offsides; + $tmp['crd'] = $val->cards; + $tmp['snt'] = $val->shots_on_target; + $tmp['tsh'] = $val->shots_off_target; - if (! isset($val->details)) { - $tmp['area'] = 'goalkeeper'; - $tmp['color_pos'] = 'gray'; - } else { - if (in_array($val->details->position, $positions_map['MIDFIELD'])) { - $tmp['area'] = 'midfield'; - $tmp['color_pos'] = 'info'; - } elseif (in_array($val->details->position, $positions_map['DEFENCE'])) { - $tmp['area'] = 'defence'; - $tmp['color_pos'] = 'success'; - } elseif (in_array($val->details->position, $positions_map['ATTACK'])) { - $tmp['area'] = 'attack'; - $tmp['color_pos'] = 'warning'; - } elseif (in_array($val->details->position, $positions_map['GOALKEEPER'])) { + $level = round($val->total_events / 3); + if ($val->total_events) { + if ($level > 1 && $val->total_events < $level) { + $tmp['color_evt'] = 'danger'; + } elseif ($val->total_events < $level * 2) { + $tmp['color_evt'] = 'info'; + } else { + $tmp['color_evt'] = 'success'; + } + } + + if (! isset($val->details)) { $tmp['area'] = 'goalkeeper'; $tmp['color_pos'] = 'gray'; } else { - $tmp['area'] = 'defence'; - $tmp['color_pos'] = 'success'; + if (in_array($val->details->position, $positions_map['MIDFIELD'])) { + $tmp['area'] = 'midfield'; + $tmp['color_pos'] = 'info'; + } elseif (in_array($val->details->position, $positions_map['DEFENCE'])) { + $tmp['area'] = 'defence'; + $tmp['color_pos'] = 'success'; + } elseif (in_array($val->details->position, $positions_map['ATTACK'])) { + $tmp['area'] = 'attack'; + $tmp['color_pos'] = 'warning'; + } elseif (in_array($val->details->position, $positions_map['GOALKEEPER'])) { + $tmp['area'] = 'goalkeeper'; + $tmp['color_pos'] = 'gray'; + } else { + $tmp['area'] = 'defence'; + $tmp['color_pos'] = 'success'; + } } - } - $result[] = $tmp; + $result[] = $tmp; + } } // dd($result); diff --git a/composer.lock b/composer.lock index b8417439..4bce2162 100644 --- a/composer.lock +++ b/composer.lock @@ -7361,16 +7361,16 @@ }, { "name": "symfony/console", - "version": "v7.4.18", + "version": "v7.4.19", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "23d6f88a29f6d0eac45bd77d70307adf83ba7ab0" + "reference": "3a1973458b153f566a8d7499bc06ece323d60063" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/23d6f88a29f6d0eac45bd77d70307adf83ba7ab0", - "reference": "23d6f88a29f6d0eac45bd77d70307adf83ba7ab0", + "url": "https://api.github.com/repos/symfony/console/zipball/3a1973458b153f566a8d7499bc06ece323d60063", + "reference": "3a1973458b153f566a8d7499bc06ece323d60063", "shasum": "" }, "require": { @@ -7435,7 +7435,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.4.18" + "source": "https://github.com/symfony/console/tree/v7.4.19" }, "funding": [ { @@ -7455,7 +7455,7 @@ "type": "tidelift" } ], - "time": "2026-08-25T14:18:37+00:00" + "time": "2026-09-13T10:38:41+00:00" }, { "name": "symfony/css-selector", @@ -7846,16 +7846,16 @@ }, { "name": "symfony/finder", - "version": "v7.4.17", + "version": "v7.4.19", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "5ce28827081f6d1f0c32eaf3882750f19cb5bbe6" + "reference": "1b900bc6ae5ba60c5eee69c11ba44566190576fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/5ce28827081f6d1f0c32eaf3882750f19cb5bbe6", - "reference": "5ce28827081f6d1f0c32eaf3882750f19cb5bbe6", + "url": "https://api.github.com/repos/symfony/finder/zipball/1b900bc6ae5ba60c5eee69c11ba44566190576fe", + "reference": "1b900bc6ae5ba60c5eee69c11ba44566190576fe", "shasum": "" }, "require": { @@ -7890,7 +7890,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.4.17" + "source": "https://github.com/symfony/finder/tree/v7.4.19" }, "funding": [ { @@ -7910,20 +7910,20 @@ "type": "tidelift" } ], - "time": "2026-08-21T12:09:28+00:00" + "time": "2026-09-10T19:14:10+00:00" }, { "name": "symfony/html-sanitizer", - "version": "v7.4.18", + "version": "v7.4.19", "source": { "type": "git", "url": "https://github.com/symfony/html-sanitizer.git", - "reference": "5394e10c12b6190c019e3112e8b534180c22f0da" + "reference": "d49c351e24d38604466e5a51ab20cbc99f9493c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/html-sanitizer/zipball/5394e10c12b6190c019e3112e8b534180c22f0da", - "reference": "5394e10c12b6190c019e3112e8b534180c22f0da", + "url": "https://api.github.com/repos/symfony/html-sanitizer/zipball/d49c351e24d38604466e5a51ab20cbc99f9493c7", + "reference": "d49c351e24d38604466e5a51ab20cbc99f9493c7", "shasum": "" }, "require": { @@ -7964,7 +7964,7 @@ "sanitizer" ], "support": { - "source": "https://github.com/symfony/html-sanitizer/tree/v7.4.18" + "source": "https://github.com/symfony/html-sanitizer/tree/v7.4.19" }, "funding": [ { @@ -7984,20 +7984,20 @@ "type": "tidelift" } ], - "time": "2026-08-30T00:47:26+00:00" + "time": "2026-09-04T10:11:42+00:00" }, { "name": "symfony/http-foundation", - "version": "v7.4.18", + "version": "v7.4.19", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "d070b716a32fbe3bf04204db0f58ace73b86d133" + "reference": "f7b953be7801974a5a0685e1228bbc3b12b35936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d070b716a32fbe3bf04204db0f58ace73b86d133", - "reference": "d070b716a32fbe3bf04204db0f58ace73b86d133", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/f7b953be7801974a5a0685e1228bbc3b12b35936", + "reference": "f7b953be7801974a5a0685e1228bbc3b12b35936", "shasum": "" }, "require": { @@ -8046,7 +8046,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v7.4.18" + "source": "https://github.com/symfony/http-foundation/tree/v7.4.19" }, "funding": [ { @@ -8066,20 +8066,20 @@ "type": "tidelift" } ], - "time": "2026-08-30T20:10:52+00:00" + "time": "2026-09-14T17:41:17+00:00" }, { "name": "symfony/http-kernel", - "version": "v7.4.18", + "version": "v7.4.19", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "275d2d2d24530f2a0eaf17704a3a93860a036351" + "reference": "683507424cc84ca85ac1551adb609b6b98216667" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/275d2d2d24530f2a0eaf17704a3a93860a036351", - "reference": "275d2d2d24530f2a0eaf17704a3a93860a036351", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/683507424cc84ca85ac1551adb609b6b98216667", + "reference": "683507424cc84ca85ac1551adb609b6b98216667", "shasum": "" }, "require": { @@ -8165,7 +8165,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v7.4.18" + "source": "https://github.com/symfony/http-kernel/tree/v7.4.19" }, "funding": [ { @@ -8185,20 +8185,20 @@ "type": "tidelift" } ], - "time": "2026-08-30T21:24:29+00:00" + "time": "2026-09-15T07:09:35+00:00" }, { "name": "symfony/mailer", - "version": "v7.4.17", + "version": "v7.4.19", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "b17c9bf3a551d5f635638a3b6c05f06c4dc87584" + "reference": "6f6f2441bef07a42d2617b9b3aadf04a321aa514" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/b17c9bf3a551d5f635638a3b6c05f06c4dc87584", - "reference": "b17c9bf3a551d5f635638a3b6c05f06c4dc87584", + "url": "https://api.github.com/repos/symfony/mailer/zipball/6f6f2441bef07a42d2617b9b3aadf04a321aa514", + "reference": "6f6f2441bef07a42d2617b9b3aadf04a321aa514", "shasum": "" }, "require": { @@ -8249,7 +8249,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v7.4.17" + "source": "https://github.com/symfony/mailer/tree/v7.4.19" }, "funding": [ { @@ -8269,20 +8269,20 @@ "type": "tidelift" } ], - "time": "2026-08-21T17:40:08+00:00" + "time": "2026-09-15T06:01:15+00:00" }, { "name": "symfony/mime", - "version": "v7.4.18", + "version": "v7.4.19", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "bf328d82105831db3e409195db0540ff57f27c80" + "reference": "f8ac7d0a800bcabbcd1f7de56594cf05e6cd5693" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/bf328d82105831db3e409195db0540ff57f27c80", - "reference": "bf328d82105831db3e409195db0540ff57f27c80", + "url": "https://api.github.com/repos/symfony/mime/zipball/f8ac7d0a800bcabbcd1f7de56594cf05e6cd5693", + "reference": "f8ac7d0a800bcabbcd1f7de56594cf05e6cd5693", "shasum": "" }, "require": { @@ -8338,7 +8338,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v7.4.18" + "source": "https://github.com/symfony/mime/tree/v7.4.19" }, "funding": [ { @@ -8358,7 +8358,7 @@ "type": "tidelift" } ], - "time": "2026-08-22T09:04:42+00:00" + "time": "2026-09-04T10:45:44+00:00" }, { "name": "symfony/polyfill-ctype", @@ -9271,16 +9271,16 @@ }, { "name": "symfony/process", - "version": "v7.4.18", + "version": "v7.4.19", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "058d17fc284cce14efb2385783b55014a461b176" + "reference": "ed0ae095b86994d370d5791612e55984f15aa30e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/058d17fc284cce14efb2385783b55014a461b176", - "reference": "058d17fc284cce14efb2385783b55014a461b176", + "url": "https://api.github.com/repos/symfony/process/zipball/ed0ae095b86994d370d5791612e55984f15aa30e", + "reference": "ed0ae095b86994d370d5791612e55984f15aa30e", "shasum": "" }, "require": { @@ -9312,7 +9312,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.4.18" + "source": "https://github.com/symfony/process/tree/v7.4.19" }, "funding": [ { @@ -9332,7 +9332,7 @@ "type": "tidelift" } ], - "time": "2026-08-21T17:40:08+00:00" + "time": "2026-09-02T12:38:34+00:00" }, { "name": "symfony/routing", @@ -9508,16 +9508,16 @@ }, { "name": "symfony/string", - "version": "v7.4.15", + "version": "v7.4.19", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "e394af32256bf9e7bf80849d95e589167c10097b" + "reference": "02731ce2bd26514bec9efc0baef2cd0b0cf67f46" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/e394af32256bf9e7bf80849d95e589167c10097b", - "reference": "e394af32256bf9e7bf80849d95e589167c10097b", + "url": "https://api.github.com/repos/symfony/string/zipball/02731ce2bd26514bec9efc0baef2cd0b0cf67f46", + "reference": "02731ce2bd26514bec9efc0baef2cd0b0cf67f46", "shasum": "" }, "require": { @@ -9575,7 +9575,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.4.15" + "source": "https://github.com/symfony/string/tree/v7.4.19" }, "funding": [ { @@ -9595,7 +9595,7 @@ "type": "tidelift" } ], - "time": "2026-07-28T07:33:02+00:00" + "time": "2026-09-11T14:46:58+00:00" }, { "name": "symfony/translation",