title: Laravel array to update multiple rows
body: <p>I've done a ton of looking through older posts and no luck yet, 
  I'm trying to update multiple rows within a table from a single form with the ID being the primary key.</p>
  
  <p>The contents are being displayed in what looks like a spreadsheet where the user can edit multiple rows.</p>
  
  <p>I'm getting an undefined index: ID error. </p>
  
  <p>The code I'm using bellow seems really close though something isn't right.</p>
  
  <p>If anyones done this before and can correct this code your help would be greatly appreciated!</p>
  
  <p>Thank you.</p>
  
  <pre><code>protected function updateMultiple(Request $request)
  
  {
  
      $data = $request-&gt;except(['_token']);
  
      //  dd($data);
      for($i = 0; $i &lt;= count($data['id']); $i++) {
  
          $input = [
              'id' =&gt; $data['id'][$i],
              'Channel' =&gt; $data['Channel'][$i],
              'Posts' =&gt; $data['Posts'][$i],
              'Monthly_Admin_Fee' =&gt; $data['Monthly_Admin_Fee'][$i],
              'Legal_Fee' =&gt; $data['Legal_Fee'][$i],
              'Valuation_Fee' =&gt; $data['Valuation_Fee'][$i],
              'Mortgage_Risk_Fee' =&gt; $data['Mortgage_Risk_Fee'][$i],
          ];
  
          DB::table('membership')-&gt;update($input);
  
      }
  
  }
  </code></pre>
  
  <p>View</p>
  
  <pre><code>        @foreach($members as $member)
              &lt;tr&gt;
                  &lt;td class="text-right"&gt;
                      &lt;input type="text" style="padding-right: 8px;padding-left: 8px;" name="id[]" id="id"&gt;{{$member-&gt;id}}&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" id="Channel" name="Channel[]" class="form-control" value="{{$member-&gt;Channel}}"&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" id="Posts" name="Posts[]" class="form-control" value="{{$member-&gt;Posts}}"&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" id="Monthly_Admin_Fee" name="Monthly_Admin_Fee[]" class="form-control" value="{{$member-&gt;Monthly_Admin_Fee}}"&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" id="Legal_Fee" name="Legal_Fee[]" class="form-control" value="{{$member-&gt;Legal_Fee}}"&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" id="Valuation_Fee" name="Valuation_Fee[]" class="form-control" value="{{$member-&gt;Valuation_Fee}}"&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;input type="text" id="Mortgage_Risk_Fee" name="Mortgage_Risk_Fee[]" class="form-control" value="{{$member-&gt;Mortgage_Risk_Fee}}"&gt;&lt;/td&gt;
              &lt;/tr&gt;
          @endforeach
  </code></pre>