@@ -1191,32 +1191,12 @@ protected function compileWheres(): array
1191
1191
}
1192
1192
}
1193
1193
1194
- // Convert DateTime values to UTCDateTime.
1195
- if (isset ($ where ['value ' ])) {
1196
- if (is_array ($ where ['value ' ])) {
1197
- array_walk_recursive ($ where ['value ' ], function (&$ item , $ key ) {
1198
- if ($ item instanceof DateTimeInterface) {
1199
- $ item = new UTCDateTime ($ item );
1200
- }
1201
- });
1202
- } else {
1203
- if ($ where ['value ' ] instanceof DateTimeInterface) {
1204
- $ where ['value ' ] = new UTCDateTime ($ where ['value ' ]);
1205
- }
1206
- }
1207
- } elseif (isset ($ where ['values ' ])) {
1208
- if (is_array ($ where ['values ' ])) {
1209
- array_walk_recursive ($ where ['values ' ], function (&$ item , $ key ) {
1210
- if ($ item instanceof DateTimeInterface) {
1211
- $ item = new UTCDateTime ($ item );
1212
- }
1213
- });
1214
- } elseif ($ where ['values ' ] instanceof CarbonPeriod) {
1215
- $ where ['values ' ] = [
1216
- new UTCDateTime ($ where ['values ' ]->getStartDate ()),
1217
- new UTCDateTime ($ where ['values ' ]->getEndDate ()),
1218
- ];
1219
- }
1194
+ // Convert CarbonPeriod to UTCDateTime interval.
1195
+ if (isset ($ where ['values ' ]) && $ where ['values ' ] instanceof CarbonPeriod) {
1196
+ $ where ['values ' ] = [
1197
+ new UTCDateTime ($ where ['values ' ]->getStartDate ()),
1198
+ new UTCDateTime ($ where ['values ' ]->getEndDate ()),
1199
+ ];
1220
1200
}
1221
1201
1222
1202
// In a sequence of "where" clauses, the logical operator of the
@@ -1645,6 +1625,8 @@ private function aliasIdForQuery(array $values): array
1645
1625
foreach ($ values as &$ value ) {
1646
1626
if (is_array ($ value )) {
1647
1627
$ value = $ this ->aliasIdForQuery ($ value );
1628
+ } elseif ($ value instanceof DateTimeInterface) {
1629
+ $ value = new UTCDateTime ($ value );
1648
1630
}
1649
1631
}
1650
1632
0 commit comments