add 2 parts for claculation pp wip
This commit is contained in:
1 parent
6d2f4c1052
commit
ad45880506
19 files changed
+1403
-1049
No files matched your search
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits\PlayerProps;
|
||||
|
||||
trait ClearBoxes
|
||||
{
|
||||
public function clearBox(int $boxNumber): void
|
||||
{
|
||||
if (isset($this->boxes[$boxNumber])) {
|
||||
$tmp = $this->boxes[$boxNumber];
|
||||
$player_id = 0;
|
||||
foreach ($tmp as $key => $value) {
|
||||
if ($key == 'id') {
|
||||
$player_id = $value;
|
||||
}
|
||||
}
|
||||
foreach ($this->players as $k => $record) {
|
||||
if ($record['id'] == (int) $player_id) {
|
||||
$this->boxes[$boxNumber] = [];
|
||||
$this->players[$k]['pos'] = '';
|
||||
$this->players[$k]['active'] = 0;
|
||||
|
||||
$this->player_on_field_counter--;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->players as $k => $record) {
|
||||
$this->players[$k]['gls'] = '';
|
||||
$this->players[$k]['fls'] = '';
|
||||
$this->players[$k]['ofs'] = '';
|
||||
$this->players[$k]['crd'] = '';
|
||||
$this->players[$k]['snt'] = '';
|
||||
$this->players[$k]['tsh'] = '';
|
||||
$this->players[$k]['wfl'] = '';
|
||||
}
|
||||
|
||||
$this->storePlacement();
|
||||
|
||||
$this->loadPlacement();
|
||||
}
|
||||
}
|
||||
|
||||
public function clearResultTable(): void
|
||||
{
|
||||
|
||||
for ($i = 1; $i <= 35; $i++) {
|
||||
$this->boxes[$i] = [];
|
||||
}
|
||||
|
||||
foreach ($this->players as $k => $record) {
|
||||
// $this->players[$k] = [];
|
||||
$this->players[$k]['active'] = 0;
|
||||
$this->players[$k]['gls'] = '';
|
||||
$this->players[$k]['fls'] = '';
|
||||
$this->players[$k]['ofs'] = '';
|
||||
$this->players[$k]['crd'] = '';
|
||||
$this->players[$k]['snt'] = '';
|
||||
$this->players[$k]['tsh'] = '';
|
||||
$this->players[$k]['wfl'] = '';
|
||||
}
|
||||
|
||||
$this->player_on_field_counter = 0;
|
||||
|
||||
$this->dispatch('update-players', players: $this->players);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user