问题 I have 2 models in my app: 1. Customer.php 2. Car.php Now I would like to run a query that returns all customers that have less than 2 cars. Where 2 is a number that can be changed by the user. I have tried this but it didn't work, it just returns all customer records: $customers = Customer::whereHas("cars", function($query) { $query->selectRaw("count(*) < ?", [2]); }) ->get(); Edit: The two models are linked in a pivot table, meaning A customer can have more than 1 car and a Car can belong