title: Save multiple record in one to many relation laravel 5
body: <p>I'm trying to save multiple records in a one to many relationship. I have two models as following. </p>
  
  <blockquote>
    <p>Product Model</p>
  </blockquote>
  
  <pre><code>class Product extends Model
  {
      protected $primaryKey = 'product_id';
      public $timestamps = FALSE;
  
      public function Size(){
          return $this-&gt;hasMany('App\Size');
      }
  
  }
  </code></pre>
  
  <blockquote>
    <p>Size Model</p>
  </blockquote>
  
  <pre><code>class Size extends Model
  {
      public $timestamps = FALSE;
      protected $fillable = ['product_id','size'];
  
      public function Product(){
          return $this-&gt;belongsTo('App\Product');
      }
  }
  </code></pre>
  
  <p>I want to save the sizes of the product. 
  My controller is </p>
  
  <pre><code>public function store(Request $request){
  
          $product_id = Products::select('product_id')-&gt;orderBy('product_id','desc')-&gt;first();
  
          if($request-&gt;size_m) $sizes[] = array("size" =&gt; $request-&gt;size_m );
          if($request-&gt;size_l) $sizes[] = array("size" =&gt; $request-&gt;size_l);
          if($request-&gt;size_s) $sizes[] = array("size" =&gt; $request-&gt;size_s);
  
          $product_id-&gt;Size()-&gt;saveMany($sizes);
  
  
      }
  </code></pre>
  
  <p>But I'm getting the following error</p>
  
  <blockquote>
    <p>FatalThrowableError in HasOneOrMany.php line 221: Type error: Argument
    1 passed to
    Illuminate\Database\Eloquent\Relations\HasOneOrMany::save() must be an
    instance of Illuminate\Database\Eloquent\Model, array given, called in
    D:\e-commerec\blog\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Relations\HasOneOrMany.php
    on line 237</p>
  </blockquote>
  
  <p>What is the problem?</p>