@foreach ($searchalls as $searchall)
@php
$i=1
@endphp
{{$i }} ={{$loop->iteration}}%3
@if($i == 1 )
<div class="row clearfix">
@endif
<div class="col-md-4 column">
<h2>
{{$search_all->id }}Heading
</h2><p>once OK.
</p>
<p>
<a class="btn" href="#">View details »</a>
</p>
</div>
I got the result on blade is
1 =1%3
1 =2%3
1 =3%3
1 =4%3
cannot got the number remainder?
How can I fix the problem?
Do this
@foreach ($searchalls as $searchall)
@php
$i = 1;
$i = $loop->iteration%3;
@endphp
@if( $i == 1 )
<div class="row clearfix">
@endif
<div class="col-md-4 column">
<h2>
{{ $search_all->id }}Heading
</h2>
<p>
once OK.
</p>
<p>
<a class="btn" href="#">View details »</a>
</p>
</div>
Once your blade template string is rendered you essentially cannot compare with php using == in my opinion which is happening in
{{ $i }} = {{ $loop->iteration }}%3