withCount on same model crashes app #38976
Unanswered
AlbertoSinigaglia
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description:
I have the following model:
this is crashing my whole app, not even the
Handler.php
class works, it returns just a 500 error. However, if I remove$builder->withCount('categories');
, it works fine, so I suppose there is something wrong with thewithCount
related to the same modelthis happens also with:
but works if I use
Category::withCount('categories')->get();
anywhere elseUPDATE:
I've solved using
So I think it's a possible problem of infinite recursion(?) something like
Category::boot
that callsCategory::boot
etc etcBeta Was this translation helpful? Give feedback.
All reactions