Only getting accessor values on specific queries

Posted 1 month ago by jorisvanandel

Hi,

I got a few accessors defined in my Model that take some time (they sum certain values of a relationship). It's not that bad but I only want these accessors called conditionally (when I need those values).

It makes all my queries rather slow and I only need the accessor values on certain queries.

How can I conditionally call the accessors so they don't slow down queries they don't need to?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.