title: How to show selected checkbox in multiselect checkbox list in laravel?
body: <p>I have a multi-select checkbox list. I want to show stored value in list using checkbox selected.</p>
  
  <p>User informations are stored in <strong>Partner_Prefence</strong> table and user religion column named as <strong>p_religion</strong></p>
  
  <pre><code>$profile_data= DB::table('partner_prefence')-&gt;select('p_religion')-&gt;first();
  </code></pre>
  
  <p>Fetching religions from religions table</p>
  
  <pre><code>$religion_data=DB::table('religion')-&gt;select('religion_id','religion_name')-&gt;orderby('religion_name')-&gt;get();
  </code></pre>
  
  <p>Multiselect list</p>
  
  <pre><code>&lt;select  multiple="multiple" name="religion[]"&gt;
     @foreach($religion_data as $religion)
       &lt;option value="{{$religion-&gt;religion_id}}" {{$profile_data-&gt;p_religion == $religion-&gt;religion_id  ? 'selected' : ''}}&gt;{{$religion-&gt;religion_name}}&lt;/option&gt;
     @endforeach
  &lt;/select&gt;
  </code></pre>
  
  <p>I'm having trouble with showing which religions user have </p>
  
  <pre><code>{{$profile_data-&gt;p_religion == $religion-&gt;religion_id  ? 'selected' : ''}}
  </code></pre>