Hi, I have the following code with carbon where I want to get an array with the start time until the final hour every 30 min. It does not work for me Any suggestions.
$inicio = $horario[0]->end_date; // 08:00:00
$final = $horario[1]->start_date; // 12:00:00
$cerrado = array(); //added
$h = 0;
$i = Carbon::parse($inicio)->toTimeString();
$f = Carbon::parse($final)->toTimeString();
while($i <= $f){
$cerrado[] = Carbon::parse($inicio)->copy()->addMinute($h)->format('H:i:s');
$h=$h+30;
}
dd($cerrado);