title: Checkbox selection with two foreach loops
body: <p>I have below code for showing all taxes as checkboxes,
  I am using same form for editing taxes,</p>
  <pre><code>@foreach($taxes as $t)
     @foreach($grouptax_taxes as $tg)
     &lt;label class=&quot;checkbox&quot;&gt;
     &lt;input type=&quot;checkbox&quot; name=&quot;taxgroup_rate[]&quot; {{ isset($taxgroup) &amp;&amp; $t-&gt;tax_id == $tg-&gt;tax_id ? 'checked' : ''}} id=&quot;taxgroup_{{$t-&gt;tax_id}}&quot; value=&quot;{{$t-&gt;tax_id}}&quot;&gt;
     &lt;span&gt;&lt;/span&gt;{{$t-&gt;tax_name}} - {{$t-&gt;tax_rate}} &amp;percnt; &lt;/label&gt;
     @endforeach
  @endforeach
  </code></pre>
  <p>Problem is that it repeats all taxes multiple times as grouptax_rate, I know it will do repeat, but not sure how to select only those checkboxes which values are in <code>$grouptax_taxes</code> and remaining <code>$taxes</code> should not be selected,</p>
  <p>How can I do that?</p>