title: How to show selected value from database in dropdown using Laravel?
body: <p>I want to show selected value from database into dropdown list on page load.</p>
  
  <p>My controller index function is :</p>
  
  <pre><code>public function index()
  { 
   $country_data =DB::table('country')-&gt;select('country_id','country_name')-&gt;get();
  $profile_data= DB::table('profiles')-&gt;select('*')-&gt;where('id',$user_id)-&gt;first();
  return view('profile_update',compact('profile_data','country_data'));
  }
  </code></pre>
  
  <p>Column name in database for height is :Height</p>
  
  <p>My dropdown in profile_update.blade.php is </p>
  
  <pre><code>&lt;select class="select4" name="country" id="country"&gt;
  &lt;option value=""&gt;Please Select&lt;/option&gt;
   @foreach($country_data as $country)
  &lt;option value="{{$country-&gt;country_id}}" {{$country_data-&gt;country == $country-&gt;country_id  ? 'selected' : ''}}&gt;{{$country-&gt;country_name}}&lt;/option&gt;
   @endforeach&lt;/select&gt;
  </code></pre>