title: Laravel pass array from form and parse in controller
body: <p>I have a array of inputs like bellow:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;input type='hidden' name='sheepNames[]' value='bab' /&gt;
  &lt;input type='hidden' name='sheepNames[]' value='harry' /&gt;
  &lt;input type='hidden' name='sheepTitles[]' value='leader' /&gt;
  &lt;input type='hidden' name='sheepTitles[]' value='sheep' /&gt;
  </code></pre>
  
  <p>In my controller I need to loop through the arrays and save them in a database with columns <code>name</code> and <code>title</code></p>
  
  <pre><code>bab | leader &lt;br&gt;
  harry | sheep
  </code></pre>
  
  <pre class="lang-php prettyprint-override"><code>  $array = $request-&gt;get('sheepNames');
  
    foreach($array as $i =&gt; $item)
    {
      $tb_name-&gt;name= $array[$i];
      $tb_name-&gt;title= $request-&gt;get('sheepTitles')[$i];
    }
  </code></pre>
  
  <p>Tried numerous ways of accessing the array but can't seem to figure it out.</p>