I have hasManyThrough relation.
public function orders()
{
return $this->hasManyThrough(Order::class, Customer::class, 'email', 'customer_id', 'email', 'email');
}
Now after something like that...
{{ $user->orders->count() }}
I get 14 orders for defined user. It's good. But...
After similar code...
User::withCount('orders')...
Count is different for the same user.
I see error in debugbar sql info.
Should be users.email = customers.email...
Is there a way to change it?