title: How to store multiple images in the database Laravel
body: <p>I'm trying to store multiple images in the database and also show them in the view. I have products table and images table which are related, in the images table I have a foreign key named(image). So far am getting this error <code>"Array to string conversion"</code></p>
  
  <p>Here are the codes</p>
  
  <p>Controller</p>
  
  <pre><code>  public function store(Request $request) 
    { 
  
      $formInput=$request-&gt;all();
      $image=array();
      if($files=$request-&gt;file('image')){
          foreach($files as $file){
              $name=$file-&gt;getClientOriginalName();
              $file-&gt;move('images',$name);
              $image[]=$name;
  
          }
  
      }
            product::create(array_merge($formInput,
         ['user_id' =&gt; Auth::user()-&gt;id,
         'image' =&gt; $image
  
      ])); 
      return redirect()-&gt;back(); 
  </code></pre>
  
  <p>Blade</p>
  
  <pre><code>  &lt;input type="file" name="image[]" multiple class="form-control"&gt;
  </code></pre>
  
  <p>Product.php</p>
  
  <pre><code>   public function products()
   {
      return $this-&gt;belongsTo('App\Images', 'image');
    }
  </code></pre>
  
  <p>Images.php</p>
  
  <pre><code>   public function images()
     {
       return $this-&gt;hasMany(Product::class, 'image');
      }
  </code></pre>