title: Eloquent ManyToMany Relationship Issue: Cardinality violation
body: <p>I have 3 tables one is a link table between the other two. A simple Many To Many Link. </p>
  
  <pre><code>videos (Table fields shortened for brevity)
  +----+---------------------+
  | id | name                |
  +----+---------------------+
  |  1 | test                |
  |  2 | Test Subscription 1 |
  +----+---------------------+
  
  subscriptions
  +----+--------+
  | id | name   |
  +----+--------+
  |  1 | News   |
  |  2 | Sports |
  |  3 | Gospel |
  |  4 | Kids   |
  +----+--------+
  
  subscription_video (link table between both models)
  +----+-----------------+----------+
  | id | subscription_id | video_id |
  +----+-----------------+----------+
  |  1 |               1 |        2 |
  +----+-----------------+----------+
  </code></pre>
  
  <p>Migration used to create link table</p>
  
  <pre><code>Schema::create('subscription_video', function(Blueprint $table)
  {
      $table-&gt;increments('id');
      $table-&gt;integer('subscription_id')-&gt;unsigned();
      $table-&gt;foreign('subscription_id')-&gt;references('id')-&gt;on('subscriptions');
      $table-&gt;integer('video_id')-&gt;unsigned()-&gt;nullable();
      $table-&gt;foreign('video_id')-&gt;references('id')-&gt;on('videos');
  });
  </code></pre>
  
  <p>Eloquent Model</p>
  
  <pre><code>class Video extends Model {
  
      use SoftDeletes;
  
      /**
       * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
       */
      public function subscriptions()
      {
          return $this-&gt;belongsToMany('App\Subscription');
      }
  
      /**
       * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
       */
      public function categories()
      {
          return $this-&gt;belongsToMany('App\Category');
      }
  }
  </code></pre>
  
  <p>Now as per documentation i should be able to simply retrieve results via a call to </p>
  
  <pre><code>Video::has('subscriptions')-&gt;get()
  </code></pre>
  
  <p>Actual view code (same error occurs with or without the orderBy)</p>
  
  <pre><code>public function index()
  {
      $videos = Video::has('subscriptions')-&gt;orderBy('id', 'desc')-&gt;get();
      return view('subscription.video.index', ['videos' =&gt; $videos ]);
  }   
  </code></pre>
  
  <p>Which in should in this case return 1 result set with video_id 2. But no matter what i try i keep getting </p>
  
  <pre><code>SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 9 column(s) (SQL: select `id`, `name` from `videos` where `videos`.`deleted_at` is null and (select * from `subscriptions` inner join `subscription_video` on `subscriptions`.`id` = `subscription_video`.`subscription_id` where `subscription_video`.`video_id` = `videos`.`id`) = 1)
  </code></pre>
  
  <p>I don't know what i am doing wrong with these relationships and how to make Eloquent return the correct results ?</p>
  
  <p>Any assistance would be appreciated.</p>
  
  <p><code>
   1. in Connection.php line 620
   2. at Connection-&gt;runQueryCallback('select * from</code>videos<code>where</code>videos<code>.</code>deleted_at<code>is null and (select * from</code>subscriptions<code>inner join</code>subscription_video<code>on</code>subscriptions<code>.</code>id<code>=</code>subscription_video<code>.</code>subscription_id<code>where</code>subscription_video<code>.</code>video_id<code>=</code>videos<code>.</code>id<code>) &gt;= 1 order by</code>id<code>desc', array(), object(Closure)) in Connection.php line 576
   3. at Connection-&gt;run('select * from</code>videos<code>where</code>videos<code>.</code>deleted_at<code>is null and (select * from</code>subscriptions<code>inner join</code>subscription_video<code>on</code>subscriptions<code>.</code>id<code>=</code>subscription_video<code>.</code>subscription_id<code>where</code>subscription_video<code>.</code>video_id<code>=</code>videos<code>.</code>id<code>) &gt;= 1 order by</code>id<code>desc', array(), object(Closure)) in Connection.php line 293
   4. at Connection-&gt;select('select * from</code>videos<code>where</code>videos<code>.</code>deleted_at<code>is null and (select * from</code>subscriptions<code>inner join</code>subscription_video<code>on</code>subscriptions<code>.</code>id<code>=</code>subscription_video<code>.</code>subscription_id<code>where</code>subscription_video<code>.</code>video_id<code>=</code>videos<code>.</code>id<code>) &gt;= 1 order by</code>id<code>desc', array(), true) in Builder.php line 1377
   5. at Builder-&gt;runSelect() in Builder.php line 1367
   6. at Builder-&gt;getFresh(array('*')) in Builder.php line 1354
   7. at Builder-&gt;get(array('*')) in Builder.php line 380
   8. at Builder-&gt;getModels(array('*')) in Builder.php line 162
   9. at Builder-&gt;get() in SubscriptionVideoController.php line 33
   10. at SubscriptionVideoController-&gt;index()
  </code></p>