title: Laravel 4 belongsToMany Relationship Returns Empty
body: <p>I'm using Laravel 4, and I'm struggling to set up a many to many relationships. Here's an example of what I'm trying to do. Here, I'm trying to establish a many to many relationship between a User and an Organization.</p>
  
  <p>Here's my migration file, creating a users table, an organizations table, and a pivot table to go between the two.</p>
  
  <pre><code>public function up()
  {
      Schema::create('users', function(Blueprint $table)
      {
          $table-&gt;increments('id');
          $table-&gt;string('email');
          $table-&gt;string('password');
          $table-&gt;timestamps();
      });
  
      Schema::create('organizations', function(Blueprint $table)
      {
          $table-&gt;increments('id');
          $table-&gt;string('name');
          $table-&gt;timestamps();
      });
  
      Schema::create('organization_user', function(Blueprint $table)
      {
          $table-&gt;increments('id');
          $table-&gt;integer('organization_id')-&gt;unsigned()-&gt;index();
          $table-&gt;foreign('organization_id')-&gt;references('id')-&gt;on('organizations')-&gt;onDelete('cascade');
          $table-&gt;integer('user_id')-&gt;unsigned()-&gt;index();
          $table-&gt;foreign('user_id')-&gt;references('id')-&gt;on('users')-&gt;onDelete('cascade');
          $table-&gt;timestamps();
      });
  }
  </code></pre>
  
  <p>I've also used the default User model, and added the belongsToMany relationship.</p>
  
  <pre><code>    use Illuminate\Auth\UserTrait;
      use Illuminate\Auth\UserInterface;
      use Illuminate\Auth\Reminders\RemindableTrait;
      use Illuminate\Auth\Reminders\RemindableInterface;
  
      class User extends Eloquent implements UserInterface, RemindableInterface {
  
          use UserTrait, RemindableTrait;
  
          /**
           * The database table used by the model.
           *
           * @var string
           */
          protected $table = 'users';
  
          /**
           * The attributes excluded from the model's JSON form.
           *
           * @var array
           */
          protected $hidden = array('password', 'remember_token');
  
          public function organizations()
          {           
              return $this-&gt;belongsToMany('Organization');
          }
  
      }
  </code></pre>
  
  <p>And I've created an Organization model with the relationship going in the opposite direction.</p>
  
  <pre><code>class Organization extends \Eloquent {
      protected $fillable = ['name'];
  
      public function users()
      {
          return $this-&gt;belongsToMany('User');
      }
  }
  </code></pre>
  
  <p>The issue is if I try to do a query using User::find(1)->organizations(), of course after adding in sample data, it's always returning as an empty array, and the same goes for the opposite direction using Organization::find(1)->users(). The weird part is that if I try to do something like Organization::find(1)->users()->attach(1), it adds the appropriate row within the pivot table, so it knows the relationship is there.</p>
  
  <p>Any ideas on why it seems the queries aren't working?</p>