title: Laravel 5 Querying with relations causes "Call to a member function addEagerConstraints() on null" error
body: <p>I have been trying to create a simple user management system but keep on hitting road blocks when it comes to querying relations.  For example I have <strong>users</strong> and <strong>roles</strong> and whenever I try to make a query for all users and their roles I get an error.  The one in the title is only the latest one I've encountered.</p>
  
  <p>My User and Role Models look like this:</p>
  
  <pre><code>class Role extends Model
  {
      public function users()
      {
          $this-&gt;belongsToMany('\App\User', 'fk_role_user', 'role_id', 'user_id');
      }
  }
  </code></pre>
  
  <hr>
  
  <pre><code>class User extends Model
  {
      public function roles()
      {
          $this-&gt;belongsToMany('\App\Role', 'fk_user_role', 'user_id', 'role_id');
      }
  }
  </code></pre>
  
  <p>My migration table for many-to-many relationship between the two looks like this:</p>
  
  <pre><code>public function up()
      {
          Schema::create('role_user', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;integer('user_id')-&gt;unsigned()-&gt;nullable(); //fk =&gt; users
              $table-&gt;integer('role_id')-&gt;unsigned()-&gt;nullable(); //fk =&gt; roles
  
              $table-&gt;foreign('fk_user_role')-&gt;references('id')-&gt;on('users')-&gt;onDelete('cascade');
              $table-&gt;foreign('fk_role_user')-&gt;references('id')-&gt;on('roles')-&gt;onDelete('cascade');
          });
      }
  </code></pre>
  
  <p>And then I try to get all records with their relation in a controller:</p>
  
  <pre><code>public function index()
  {
      $users = User::with('roles')-&gt;get();
  
      return $users;
  }
  </code></pre>
  
  <p>So I need another pair of eyes to tell me what is it I am missing here?</p>