declare variable in view for loop laravel
@foreach ($posts as $post)
@if ($post->type == 1)
@continue
@endif
@if ($user->type == 5)
@break
@endif
<li>{{ $post->title }}</li>
@endforeach
<!-- Alternatively -->
@foreach ($posts as $post)
@continue($post->type == 1)
@break($post->type == 5)
<li>{{ $post->title }}</li>
@endforeach