coder2 Saat slotları programsal olarak şöyle oluşturulabilir:
$dates = Carbon\CarbonPeriod::create(today()->startOfDay(), '3 hours', today()->endOfDay())
->setDateClass(Carbon\CarbonImmutable::class)
->toArray();
array_push($dates, today()->endOfDay());
$slots = [];
for($i = 0; $i < count($dates) - 1; $i++) {
$slots[] = [
$dates[$i]->toISOString(),
$dates[$i + 1]->subMicroseconds($i + 1 === count($dates) - 1 ? 0 : 1)->toISOString()
];
}
$slots
[
[
"2021-12-04T00:00:00.000000Z",
"2021-12-04T02:59:59.999999Z",
],
[
"2021-12-04T03:00:00.000000Z",
"2021-12-04T05:59:59.999999Z",
],
[
"2021-12-04T06:00:00.000000Z",
"2021-12-04T08:59:59.999999Z",
],
[
"2021-12-04T09:00:00.000000Z",
"2021-12-04T11:59:59.999999Z",
],
[
"2021-12-04T12:00:00.000000Z",
"2021-12-04T14:59:59.999999Z",
],
[
"2021-12-04T15:00:00.000000Z",
"2021-12-04T17:59:59.999999Z",
],
[
"2021-12-04T18:00:00.000000Z",
"2021-12-04T20:59:59.999999Z",
],
[
"2021-12-04T21:00:00.000000Z",
"2021-12-04T23:59:59.999999Z",
],
]