diff --git a/resources/views/livewire/people/history.blade.php b/resources/views/livewire/people/history.blade.php index 6ba61d018..c0c6fe069 100644 --- a/resources/views/livewire/people/history.blade.php +++ b/resources/views/livewire/people/history.blade.php @@ -30,15 +30,15 @@ class="print:break-before-page flex flex-col rounded bg-white shadow-[0_2px_15px @php $headers = [['index' => 'attribute', 'label' => __('app.attribute')], ['index' => 'old', 'label' => __('app.old')], ['index' => 'new', 'label' => __('app.new')]]; - $rows = []; - - foreach ($activity['new'] as $key => $value) { - array_push($rows, [ - 'attribute' => $key, - 'old' => $activity['old'] ? $activity['old'][$key] : null, - 'new' => $value, - ]); - } + $rows = collect($activity['new']) + ->map(function ($value, $key) use ($activity) { + return [ + 'attribute' => $key, + 'old' => $activity['old'][$key] ?? null, + 'new' => $value, + ]; + }) + ->toArray(); @endphp diff --git a/resources/views/livewire/peoplelog.blade.php b/resources/views/livewire/peoplelog.blade.php index a59e76e27..24bc7be06 100644 --- a/resources/views/livewire/peoplelog.blade.php +++ b/resources/views/livewire/peoplelog.blade.php @@ -37,14 +37,14 @@ @php $headers = [['index' => 'key', 'label' => 'Key'], ['index' => 'value', 'label' => __('app.old')]]; - $rows = []; - - foreach ($log['properties_old'] as $key => $value) { - array_push($rows, [ - 'key' => $key, - 'value' => $value, - ]); - } + $rows = collect($log['properties_old']) + ->map(function ($value, $key) { + return [ + 'key' => $key, + 'value' => $value, + ]; + }) + ->toArray(); @endphp @@ -55,12 +55,14 @@ $rows = []; - foreach ($log['properties_new'] as $key => $value) { - array_push($rows, [ - 'key' => $key, - 'value' => $value, - ]); - } + $rows = collect($log['properties_new']) + ->map(function ($value, $key) { + return [ + 'key' => $key, + 'value' => $value, + ]; + }) + ->toArray(); @endphp diff --git a/resources/views/livewire/teamlog.blade.php b/resources/views/livewire/teamlog.blade.php index adb94c11b..ba44f8624 100644 --- a/resources/views/livewire/teamlog.blade.php +++ b/resources/views/livewire/teamlog.blade.php @@ -33,12 +33,14 @@ $rows = []; - foreach ($log['properties_old'] as $key => $value) { - array_push($rows, [ - 'key' => $key, - 'value' => $value, - ]); - } + $rows = collect($log['properties_old']) + ->map(function ($value, $key) { + return [ + 'key' => $key, + 'value' => $value, + ]; + }) + ->toArray(); @endphp @@ -47,14 +49,14 @@ @php $headers = [['index' => 'key', 'label' => 'Key'], ['index' => 'value', 'label' => __('app.new')]]; - $rows = []; - - foreach ($log['properties_new'] as $key => $value) { - array_push($rows, [ - 'key' => $key, - 'value' => $value, - ]); - } + $rows = collect($log['properties_new']) + ->map(function ($value, $key) { + return [ + 'key' => $key, + 'value' => $value, + ]; + }) + ->toArray(); @endphp @@ -63,14 +65,14 @@ @php $headers = [['index' => 'key', 'label' => 'Key'], ['index' => 'value', 'label' => __('value')]]; - $rows = []; - - foreach ($log['properties'] as $key => $value) { - array_push($rows, [ - 'key' => $key, - 'value' => $value, - ]); - } + $rows = collect($log['properties']) + ->map(function ($value, $key) { + return [ + 'key' => $key, + 'value' => $value, + ]; + }) + ->toArray(); @endphp diff --git a/resources/views/profile/delete-user-form.blade.php b/resources/views/profile/delete-user-form.blade.php index 5626d5599..08a53f48e 100644 --- a/resources/views/profile/delete-user-form.blade.php +++ b/resources/views/profile/delete-user-form.blade.php @@ -21,19 +21,17 @@ ['index' => 'personal', 'label' => __('team.team_personal') . '?'], ]; - $rows = []; - - $teams = auth()->user()->teamsStatistics(); - - foreach ($teams as $team) { - array_push($rows, [ - 'team' => $team->name, - 'users' => $team->users_count > 0 ? $team->users_count : '', - 'persons' => $team->persons_count > 0 ? $team->persons_count : '', - 'couples' => $team->couples_count > 0 ? $team->couples_count : '', - 'personal' => $team->personal_team, - ]); - } + $rows = collect(auth()->user()->teamsStatistics()) + ->map(function ($team) { + return [ + 'team' => $team->name, + 'users' => $team->users_count > 0 ? $team->users_count : '', + 'persons' => $team->persons_count > 0 ? $team->persons_count : '', + 'couples' => $team->couples_count > 0 ? $team->couples_count : '', + 'personal' => $team->personal_team, + ]; + }) + ->toArray(); @endphp diff --git a/resources/views/teams/delete-team-form.blade.php b/resources/views/teams/delete-team-form.blade.php index 3caca20cb..3d04c7dc9 100644 --- a/resources/views/teams/delete-team-form.blade.php +++ b/resources/views/teams/delete-team-form.blade.php @@ -12,19 +12,7 @@ - @php - $headers = [['index' => 'object', 'label' => $team->name], ['index' => 'count', 'label' => '#']]; - - $rows = [ - ['object' => __('team.users'), 'count' => count($team->users)], - ['object' => __('team.persons'), 'count' => count($team->persons)], - ['object' => __('team.couples'), 'count' => count($team->couples)], - ]; - @endphp - - - - + @livewire('team.status', ['team' => $team]) @if ($team->isDeletable())