title: Laravel: Upload form data with images in a foreach loop using Intervention
body: <p>I'm using Laravel 5.1 and would like to have a form with a few rows of text fields with their corresponding image uploads.</p>
  
  <p>Form:</p>
  
  <pre><code>&lt;div id="row"&gt;
      &lt;input name="description[]" type="text"&gt;
      &lt;input name="image[]" type="file"&gt;
  &lt;/div&gt;
  &lt;div id="row"&gt;
      &lt;input name="description[]" type="text"&gt;
      &lt;input name="image[]" type="file"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>foreach($request-&gt;description as $key =&gt; $val){
  
  if($val != null){
      $data = new Finding;
      $data-&gt;description = $val; //save description for each loop
  
      $file = array('image' =&gt; Input::file('image'));
  
      if (Input::file('image')-&gt;isValid()) {
  
          $destinationPath = 'uploads';
          $extension = Input::file('image')-&gt;getClientOriginalExtension();
          $fileName = rand(1000,1000).'.'.$extension;
          Input::file('image')-&gt;move($destinationPath, $fileName);
          $path = Input::file('image')-&gt;getRealPath();
  
          $data-&gt;image_location = $fileName[$key]; //save filename location to db
          $data-&gt;save();
  
          flash('success', 'Uploaded Successful');
          return Redirect::to('/upload');
       } else {
          flash('error', 'Uploaded File Is Not Valid');
          return Redirect::to('/upload');
      }
  }
  </code></pre>
  
  <p>My question is, how do I use intervention with the <code>$key</code> value to save a new row in the table with the associated text description with the image upload and still use all the intervention classes? Is my code close? </p>
  
  <p>I can easily do all this with just one form input with one image upload but my goal is to have a page with multiple rows with inputs. Thanks!</p>