title: Laravel table referencing itself through pivot
body: <p>I have one table called roles:</p>
  
  <pre><code>Schema::create('roles', function (Blueprint $table) {
          $table-&gt;increments('id');
          $table-&gt;string('name');
          $table-&gt;string('description');
          $table-&gt;string('image')-&gt;default("noImage.png");
          $table-&gt;timestamps();
        });
  </code></pre>
  
  <p>and another table roles_roles</p>
  
  <pre><code>Schema::create('roles_roles', function (Blueprint $table) {
          $table-&gt;increments('id');
          $table-&gt;integer("role_id")-&gt;unsigned();
          $table-&gt;integer("role_inherit_from_id")-&gt;unsigned();
          $table-&gt;timestamps();
      });
  </code></pre>
  
  <p>I'd like one role to reference many other roles (to say one role can inherit from multiple others)
  <code>public function children(){
          return $this-&gt;hasMany(Role::class, "roles_roles", "role_inherit_from_id");</code></p>
  
  <p>but get the error: </p>
  
  <pre><code>SQLSTATE[42S22]: Column not found: 1054 Unknown column 'roles.roles_roles' in 'where clause' (SQL: select * from `roles` where `roles`.`roles_roles` is null and `roles`.`roles_roles` is not null limit 1)
  }`
  </code></pre>
  
  <p>Does anyone know how to implement a table that can reference itself, or a way to get around this?</p>