How to break a foreach loop in laravel blade view?
From the Blade docs:
When using loops you may also end the loop or skip the current iteration:
@foreach ($users as $user)
@if ($user->type == 1)
@continue
@endif
<li>{{ $user->name }}</li>
@if ($user->number == 5)
@break
@endif
@endforeach
you can break like this
@foreach($data as $d)
@if($d === "something")
{{$d}}
@if(condition)
@break
@endif
@endif
@endforeach