title: Many to many relationships in the controller
body: <p>I want my controller to send a list of products to my view, here how I try at the moment:</p>
  
  <p>Product.php</p>
  
  <pre><code>public function wishLists()
  {
      return $this-&gt;belongsToMany('App\Models\WishList');
  } 
  </code></pre>
  
  <p>Wishlist.php</p>
  
  <pre><code>public function products()
  {
      return $this-&gt;hasMany('App\Models\Product');
  }
  </code></pre>
  
  <p>WishListsController.php</p>
  
  <pre><code>public function index()
  {
      $wishList = WishList::find(1);
      $products = $wishList-&gt;products()-&gt;get();
      return view('WishLists.index',compact('products'));
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>SQLSTATE[42S22]: Column not found: 1054 Champ 'products.wish_list_id' unknow in where clause (SQL: select * from `products` where `products`.`wish_list_id` = 1 and `products`.`wish_list_id` is not null)
  </code></pre>
  
  <p>Its seems to look for a id in the table products instead of looking in the many to many table? But I can't find why.</p>