Dynamic form element names in Blade for Laravel 5.2
<p>I'm attempting to create a form to update multiple rows of data from a table.  The table has four columns ( cola, colb, colc, cold ).  I am generating the form dynamically with a foreach loop in my view.  At present I am using </p>

<pre><code>text('cola[][cola]', $this-&gt;cola...
</code></pre>

<p>And on down to name and then populate the form fields.  This works fine except that it returns an array of four arrays ( cola, colb, colc, cold ), so that I have all of my cola values in one array and all of my colb values in another etc.  </p>

<p>What I would like is to return an array of each row that is submitted, so that my result would be something like </p>

<pre><code>0(cola=3, colb=7, colc=2, cold=99)
</code></pre>

<p>So that I can access the values simply with a for each loop.  I am, however, HTML remedial and cannot seem to get the name right on the form elements to accomplish this.  I know that the answer is obvious, but I keep running into either the arrays I do not want or only submitting the data from the final row.</p>

<p>Edit for clarifications...</p>

<p>Use of </p>

<pre><code>text('row[$this-&gt;key][cola]'
</code></pre>

<p>Or</p>

<pre><code>text('row[$i][cola]'
</code></pre>

<p>with $i as an iterator results in one array with the name of $i or $this->key that only returns the last row submitted. Removing the quotes, as in </p>

<pre><code>text(row[$i][cola]
</code></pre>

<p>Results in an undefined constant, because the string is expected.</p>

<p>The closest that I have come to success is </p>

<pre><code>text('row['&lt;php echo $i ?&gt;'][cola]'
</code></pre>

<p>This actually names the form elements correctly, but breaks the elements themselves.  They render as plain text and not as input boxes.  I really am going a bit bonkers on this one.</p>