title: Laravel HasMany across multiple connections
body: <p>I want to retrieve <code>Offer</code>s related to <code>Offer</code> on a second table <code>offer_related</code> because I can't change the schema of the <code>Offer</code> table.</p>
  
  <p>I have two databases on different connections, <code>offers</code> on one, and <code>offer_related</code> on another.</p>
  
  <p>For the sake of argument, I'm going to name databases as follows for clarity in my examples with regards to which can change and which can't.</p>
  
  <ul>
  <li>database containing <code>offers</code> henceforth known as <code>immutable</code></li>
  <li>database containing <code>offer_related</code> henceforth known as <code>mutable</code></li>
  </ul>
  
  <p>Example schema is as follows</p>
  
  <pre><code>connection1.mutable.offer_related
  
  offer_id | related_offer_id
  ---------------------------
  1        | 2
  1        | 3
  
  connection2.immutable.offers
  
  id | name
  ---------------------------
  1  | foo
  2  | bar
  3  | baz
  </code></pre>
  
  <p>I'm assuming it'd be a belongsToMany relationship, but I can't seem to get it right.</p>
  
  <pre><code>return $this-&gt;belongsToMany(Offer::class, 'immutable.offer', 'id');
  
  // Syntax error or access violation: 1066 Not unique table/alias: 'offer'
  </code></pre>
  
  <p>I've also tried to manually build out a belongsToMany relationship with a custom query with no success.</p>
  
  <p>I'd like to be able to call</p>
  
  <pre><code>Offer::find(1)-&gt;related; // Offer(2), Offer(3)
  </code></pre>