title: Laravel - 1066 Not unique table/alias on a relationship
body: <p>I'm trying to create a simple relationship between tables :</p>
  
  <pre><code>- attribute_type -
      id
      name
  
  - category -
      id
      name
      description
  </code></pre>
  
  <p>So I created a pivot table to link them :</p>
  
  <pre><code>- attribute_type_category -
      attribute_type_id
      category_id
  </code></pre>
  
  <p>There is the model relationships :</p>
  
  <p>On AttributeType.php</p>
  
  <pre><code>public function category() {
      return $this-&gt;belongsToMany('App\AttributeTypeCategory', 'attribute_type_category', 'attribute_type_id', 'category_id');
  }
  </code></pre>
  
  <p>On AttributeTypeCategory.php</p>
  
  <pre><code>public function category() {
      return $this-&gt;belongsToMany('App\Category');
  }
  </code></pre>
  
  <p>All seems to be fine, but I get the following error :</p>
  
  <blockquote>
    <p>SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique
    table/alias: 'attribute_type_category' (SQL: select
    <code>attribute_type_category</code>.*,
    <code>attribute_type_category</code>.<code>attribute_type_id</code> as
    <code>pivot_attribute_type_id</code>, <code>attribute_type_category</code>.<code>category_id</code> as
    <code>pivot_category_id</code> from <code>attribute_type_category</code> inner join
    <code>attribute_type_category</code> on <code>attribute_type_category</code>.<code>id</code> =
    <code>attribute_type_category</code>.<code>category_id</code> where
    <code>attribute_type_category</code>.<code>attribute_type_id</code> = 1)</p>
  </blockquote>
  
  <p>Do you have any idea ?
  Thank you !</p>