title: Laravel - SQL query equals the value of id to null in many to many relationship
body: <p>In model I have:</p>
  
  <pre><code>class Car extends Model
  {
      public function users()
      {
          return $this-&gt;belongsToMany(User::class, 'car_user', 'car_id', 'user_id');
      }
  }
  </code></pre>
  
  <p>And in my controller I have:</p>
  
  <pre><code>\DB::enableQueryLog();
  $cars = Car::with('users')-&gt;get();
  dd(\DB::getQueryLog());
  </code></pre>
  
  <p>The queries executed are:</p>
  
  <pre><code>array:2 [▼
    0 =&gt; array:3 [▼
      "query" =&gt; "select * from `cars`"
      "bindings" =&gt; []
      "time" =&gt; 0.62
    ]
    1 =&gt; array:3 [▼
      "query" =&gt; "select `users`.*, `car_user`.`user_id` as `pivot_user_id`, `car_user`.`car_id` as `pivot_car_id` from `users` inner join `car_user` on `users`.`user_id` = `car_user`.`car_id` where `car_user`.`user_id` in (?)"
      "bindings" =&gt; array:1 [▼
        0 =&gt; null
      ]
      "time" =&gt; 0.6
    ]
  ]
  </code></pre>
  
  <p>The problem is that the <code>bindings</code> value in second query is null. I want to get all <code>cars</code> and iterate into each of them and get as many users each car has.</p>
  
  <p>How can I do that?</p>
  
  <p><strong>Edit</strong>
  table schema:</p>
  
  <p>car_user:
  car_id user_id</p>
  
  <p>cars:
  car_id car_code price</p>
  
  <p>users:
  user_id user_type username password</p>
  
  <p>Thanks</p>