- polishing calendar

This commit is contained in:
EwelinaLasowy
2022-03-10 09:30:33 +01:00
parent db4be79c91
commit 91980163e0
11 changed files with 309 additions and 20 deletions

View File

@@ -44,6 +44,7 @@ class CalendarGenerator
"isWeekend" => $day->isWeekend(),
"isHoliday" => $holidays->contains($day),
"vacations" => $vacationsForDay->pluck("user_id"),
"vacationTypes" => $vacationsForDay->pluck("vacationRequest.type", "user_id"),
];
}
@@ -55,6 +56,7 @@ class CalendarGenerator
return Vacation::query()
->whereBetween("date", [$period->start, $period->end])
->whereRelation("vacationRequest", fn(Builder $query) => $query->states(VacationRequestStatesRetriever::successStates()))
->with("vacationRequest")
->get()
->groupBy(fn(Vacation $vacation) => $vacation->date->toDateString());
}