title: Get name and value from option select in laravel
body: <p>I'm using <code>foreach</code> to show the option from database, which has value like this:</p>
  
  <pre><code>&lt;select name="location[]" data-placeholder="Search Location" multiple class="chosen-select"&gt;
     &lt;?php foreach ($location as $key): ?&gt;
       &lt;option value=""&gt;&lt;/option&gt;
       &lt;option value="{{$key-&gt;id}}"&gt;{{$key-&gt;name}}&lt;/option&gt;
     &lt;?php endforeach; ?&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>I want to pass both the <code>{{$key-&gt;name}}</code> and <code>{{$key-&gt;id}}</code> to my controller to get a response like this <code>{'name':'city', 'id': '2'}</code>.</p>
  
  <p>For now I'm only using the common way to pass the <code>{{$key-&gt;id}}</code> into controller using this method:</p>
  
  <pre><code>$loc = $request-&gt;location;
  $i = 0;
  foreach ($loc as $value) {
  
    if ($value == true) {
     $date_opt[] = [
       "id" =&gt; $value,
     ];
    }
    $i++;
  }
  return $date_opt;
  </code></pre>
  
  <p>But have no idea how to pass the <code>{{$key-&gt;name}}</code>.</p>
  
  <p>Should I put the <code>{{$key-&gt;name}}</code> in another table or is there any possible way to do it?</p>