带有Blade Framework和Laravel的动态复选框+表

I need to organize my checkbox fields in table lines.

I want every 10 items the blade breaks the table row.

Here is my code:

<table>

  <div class="btn-group" data-toggle="buttons">
    {{$i = 0}}

    @foreach($sintese as $s)
        <tr>
            <td>
                <label class="btn btn-primary">
                    <input type="checkbox" autocomplete="off" name="chksintese" id="{{$s->cod_sintese_conversa}}">
                    <span class="glyphicon glyphicon-ok"></span>
                    {{$s->descricao}}
                </label>
            </td>

            @if ($i > 10)
                {{'</tr>'}}
                {{$i = 0}}  
            @else
                {{$i++}}
            @endif

        @endforeach
    </div>

</table>

And Here is My Result:

What about:

<table>
    <div class="btn-group" data-toggle="buttons">
        <tr>
            @foreach($sintese as $s)
                <td>
                    <label class="btn btn-primary">
                        <input type="checkbox" autocomplete="off" name="chksintese" id="{{$s->cod_sintese_conversa}}">
                        <span class="glyphicon glyphicon-ok"></span>
                        {{$s->descricao}}
                    </label>
                </td>

                @if ($loop->iteration % 10 == 0 && !$loop->last)
                    </tr><tr>
                @endif
            @endforeach
        </tr>
    </div>
</table>

You're continually opening a new row tag, but only closing it every 10. You're also echoing the counter, which isn't needed. Instead, open it before the loop, then reset it every 10. Don't reset $i, but instead check it against the remainder operator, and make sure you're not going to create an empty row.

    <tr>
@foreach($sintese as $s)
        <td>
            <label class="btn btn-primary">
                <input type="checkbox" autocomplete="off" name="chksintese" id="{{$s->cod_sintese_conversa}}">
                <span class="glyphicon glyphicon-ok"></span>
                {{$s->descricao}}
            </label>
        </td>

        @if ($i % 10 == 0 && $i < count($sintese))
            <tr/><tr>
        @endif  
    <?php $i++ ?>

    @endforeach
    </tr>