staudenmeir / eloquent-has-many-deep

Laravel Eloquent HasManyThrough relationships with unlimited levels

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

withCount functionality

CrisGuzmanS opened this issue · comments

is there a way to implement withCount functionality? this is what i am trying to do:

image

My model is: Person -> PersonPublication -> Publication -> PublicationCitation -> Citation
My implementation is working fine, but i am not able to use withCount, is there a way to implement it?

Hi @CrisGuzmanS,
The issue is not withCount() here but the having() clause.

I explained this here and showed a workaround: laravel/framework#30184 (comment)

Thank you @staudenmeir that is true. For other developer that are facing the same problem than me, i found this solution: Person::has('citations','>',$number);