This helper is particularly useful when you're unsure whether a relation is already loaded and want to avoid unnecessary database calls if the data is already in memory.
Currently, loadOnce does not accept a callback like load does, as it's designed to avoid altering the query.
If you need to load nested relationships, you can do so like this:
Hey there! 👋🏻
This PR adds the
loadOnce
helper.This helper is particularly useful when you're unsure whether a relation is already loaded and want to avoid unnecessary database calls if the data is already in memory.
Currently,
loadOnce
does not accept a callback likeload
does, as it's designed to avoid altering the query.If you need to load nested relationships, you can do so like this: