find($request->get("user")); $yearPeriod = $yearPeriodRetriever->selected(); $holidays = $yearPeriod->holidays()->pluck("date"); $vacationDays = $user->vacations() ->where("year_period_id", $yearPeriod->id) ->whereRelation( "vacationRequest", fn(Builder $query) => $query->noStates(VacationRequestStatesRetriever::failedStates()), ) ->pluck("date"); return new JsonResponse([ ...$holidays->map(fn(Carbon $date) => $date->toDateString()), ...$vacationDays->map(fn(Carbon $date) => $date->toDateString()), ]); } }