I come to post my question because I've been trying to do it for hours and I didn't do anything xd.
I am sending a collection to my blade template where I do a foreach of the available hours, well it does the traversal well for me, so what I want to do, be it through an if or what they suggest, if it finds a value equal to the one I have, no show it and continue showing the rest.
Controller
$start = 08:00;
$end = 17:00;
$intervals = CarbonInterval::hours(1)->toPeriod($start, $end);
$data = ['intervals'=>$intervals];
return view('plantilla', $data);
Blade
<select name="start" class="form-select">
@foreach($intervals as $date)
<option value="$date->format('H:i')}}">
{{ $date->format('g:i a')}}
</option>
@endforeach
</select>
The select shows me the time range well, that is 8,9,10,11,12, etc etc. Now what I want is that if for example I say if($date = 08:00){ No mostrar esa hora y que continúe mostrando las demás) }
I have tried and read with unset() I have also tried with list() of the array and nothing :/.
I hope you can light the way for me, and thanks in advance.
Edit: This is the dd of $date
08:00
09:00
10:00
11:00
12:00
13:00
14:00
15:00
16:00
17:00
Php provides the function continue to make a break in the loop in this case you could try it like this
Sorry for placing the code in the image but from the mobile version it does not let me insert code
If you want to skip all 8 as you say this should work