#39 - cr fixes

This commit is contained in:
Adrian Hopek
2022-02-21 15:49:17 +01:00
parent 96192c0f2c
commit e2c3c3b708
5 changed files with 12 additions and 12 deletions

View File

@@ -7,6 +7,7 @@ namespace Toby\Domain;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Carbon;
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
use Toby\Eloquent\Models\User;
class TimesheetExport implements WithMultipleSheets
{
@@ -15,13 +16,9 @@ class TimesheetExport implements WithMultipleSheets
public function sheets(): array
{
$sheets = [];
foreach ($this->users as $user) {
$sheets[] = new TimesheetPerUserSheet($user, $this->month);
}
return $sheets;
return $this->users
->map(fn(User $user) => new TimesheetPerUserSheet($user, $this->month))
->toArray();
}
public function forUsers(Collection $users): static