checkbox from database laravel

The view:

</p>
<p>&lt;div class="form-group"&gt;<br />
@foreach($publicationPurposes as $publicationPurpose)<br />
&lt;div class="checkbox"&gt;<br />
&lt;label&gt;<br />
&lt;input name="purpose[]" id="purpose{{ $publicationPurpose-&gt;id }}" type="checkbox" value="{{ $publicationPurpose-&gt;id }}" &gt;<br />
{{ $publicationPurpose-&gt;name }}<br />
&lt;/label&gt;<br />
&lt;/div&gt;<br />
@endforeach<br />
&lt;/div&gt;</p>
<p>

The database:

checkbox from database laravel

the Controller:

</p>
<p>$publicationPurposes = PublicationPurpose::with(['publicationPurposeMediaType' =&gt; function($query){<br />
$query-&gt;with(['publicationPurposeTags', 'mediaType']);<br />
}])-&gt;get();<br />
debug($publicationPurposes);</p>
<p>return view('the-view')-&gt;with(['publicationPurposes' =&gt; $publicationPurposes,]);</p>
<p>