How to display time slots from 8 AM to 5 PM with 15-minute increments in Laravel
June 01, 2023
Use CarbonInterval.
$intervals = CarbonInterval::minutes('15')->toPeriod('0:00', '24:00');
foreach ($intervals as $date) {
dump($date->format('H:i'));
}
Ref : https://janostlund.com/2019-11-03/generate-time-ranges