title: Multiple resize image upload with Laravel
body: <p>I'm working to make a multi upload image to database with intervention resizer in Laravel.</p>
  
  <p>This is what I'm coding right now in my controller
  <code>imgProdukProc</code> controller:</p>
  
  <p></p>
  
  <pre><code>use Illuminate\Http\Request;
  use File;
  use Image;
  use App\imgProd;
  
  .....
  
  public function store(Request $request)
      {
          if($request-&gt;hasFile('img')){
              foreach ($request-&gt;file('img') as $image) {
              if ($image-&gt;isValid()) {
  
                  $img = new imgProd();
                  $image_name = uniqid() .'.'. $image-&gt;getClientOriginalExtension();
                  $path = public_path('/img/prod');
                  $imgx = Image::make($image-&gt;getRealPath());
                  $imgx-&gt;resize(360, 360, function ($constraint) {
                  $constraint-&gt;aspectRatio();
                  })-&gt;save($path.'/'.$image_name);
  
                  $img-&gt;id_prod = $request-&gt;get('id_prod');
                  $img-&gt;pics = 'img/prod/'.$image_name;
  
                  $date=date_create('now');
                  $format = date_format($date,"Y-m-d");
                  $img-&gt;date = $format;
                  $img-&gt;save();
                  return redirect('adminImgProd')-&gt;with('success', 'Picture successfully added ');
              }
          }          
      }
  }
  </code></pre>
  
  <p></p>
  
  <p>and this is my views</p>
  
  <p><b>adminImgProd Views</b></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;form enctype="multipart/form-data" action="{{url('adminImgProd')}}" method='post'&gt;
  @csrf
  
  &lt;div class="form-group"&gt;
  &lt;label&gt;CODE PRODUCT&lt;/label&gt;
  &lt;div class="input-group"&gt;
  &lt;span class="input-group-addon"&gt;&lt;span class="glyphicon glyphicon-pencil"&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;input type="text" autocomplete="off" class="form-control" id='id_prod' name='id_prod' required="required" /&gt;
  &lt;span class="input-group-addon"&gt;&lt;button type="button" onClick="javascript:openWindow2();"&gt;Select&lt;/button&gt;&lt;/span&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="form-group"&gt;
  &lt;label&gt;IMAGE PRODUCT&lt;/label&gt;
  &lt;div class="input-group"&gt;
  &lt;span class="input-group-addon"&gt;&lt;span class="glyphicon glyphicon-pencil"&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;input multiple type="file" class="form-control" name='img[]' id='file-input' required="required" /&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Code above is working , but somehow when I tried to upload 2 images or 3 images the only image saved both in target folder and in database is only one and it is the last one <br></p>
  
  <p>Where is my code mistake , or just my code simply wrong from the start ?</p>
  
  <p>Thank you in advance</p>