title: laravel save many to many polymorphic
body: <p>hi i want to save many to many polymorphic</p>
  
  <p>in my case i want to save tag for book-review</p>
  
  <p>it save tag but it save something more than tag</p>
  
  <pre><code>85  App\Models\Book_Review  132 1   2018-11-25 14:42:20 2018-11-25 14:42:20
  86  App\Models\Book_Review  132 85      
  87  App\Models\Book_Review  132 2   2018-11-25 14:42:22 2018-11-25 14:42:22
  88  App\Models\Book_Review  132 87      
  89  App\Models\Book_Review  132 3   2018-11-25 14:42:23 2018-11-25 14:42:23
  90  App\Models\Book_Review  132 89      
  </code></pre>
  
  <p>it save the tag and between every tag it save an object of taggable table with tag id of previous taggable object</p>
  
  <p>this is my tag model relation</p>
  
  <pre><code>public function books_review()
  {
      return $this-&gt;morphedByMany(Book_Review::class, 'taggable');
  }
  </code></pre>
  
  <p>and this is my book-review model relation </p>
  
  <pre><code>public function tags()
  {
      return $this-&gt;morphToMany(Tag::class, 'taggable');
  }
  </code></pre>
  
  <p>and this the part that i save tag in my controller</p>
  
  <pre><code>    foreach ($request-&gt;tagid as $item) {
  
  
          $book_review_tag = new Taggable();
          $taggable_id = strval($book_review-&gt;id);
          $book_review_tag-&gt;taggable_type = $this-&gt;Model;
          $book_review_tag-&gt;taggable_id = $taggable_id;
  
          $book_review_tag-&gt;tag_id = $item;
          $book_review-&gt;tags()-&gt;saveMany([$book_review_tag]);
  
      }
  </code></pre>
  
  <p>i use debugger and show me that it get id as a parameter when it goes back to the first of the for loop
  and yet i don't know how to fix it</p>