title: Laravel Polymorphic Many-to-Many relationship pivot table with relationship to another Model
body: <p>I have the following table structure as shown in the diagram:
  <a href="https://i.stack.imgur.com/vp6b5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vp6b5.png" alt="database diagram" /></a></p>
  <p>Briefly, it is composed of several many-to-many polymorphic relationships as described:</p>
  <ul>
  <li><p>many <code>resources</code> can have many <code>sources</code> and the pivot table <code>sourceables</code> contains <code>catalog_number</code> and <code>lot_number</code> information to make each row in the pivot table unique. Many resources could also come from the same source or from different sources, differentiated by the catalog number and lot number on the pivot table.</p>
  </li>
  <li><p>many <code>resources</code> can also have many <code>publications</code> attached to it, through the <code>publicationables</code> table with <code>notes</code> on the pivot table</p>
  </li>
  <li><p>a resource's source could also be described in many publications.</p>
  </li>
  </ul>
  <p>My questions:</p>
  <ol>
  <li>Since the resource's source is differentiated by the pivot table <code>sourceables</code> how should I save the relationship between the pivot rows of <code>sourceables</code> to the <code>publications</code>?</li>
  <li>Can you have a custom intermediate table models between both <code>sourceables</code> and 'publicationables' to link to the <code>publications</code>?</li>
  <li>How to retrieve a resource with all it's publications and also with the sources with all corresponding publications?</li>
  </ol>