Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

MirasMustimuly's avatar

Refactor huge eloquent query

Hi! I have this HUGE query. I was wondering are there any techniques to refactor queries when they grow too big?

0 likes
2 replies
TerrePorter's avatar

@miggi maybe integrate the relationship functions in to the relationship on the model class. Or make a custom one that includes the filtered, productBonusesForAllClientsWithActiveCurrent, as example.

Please or to participate in this conversation.