Eager load or lazy load on modals?
Sorry for the silly question. I have an Edit modal for a record on my table. I am using
$record->supplier
in multiple places ( supplier
being a relationship which gets the supplier modal for the table record ). Is a query being run each time to get the supplier info or is it eager loaded the once?
Thanks all. I am running $record->supplier
maybe five times through the schema so I idealy I didnt want to be running a query five times for the same thing.
Example code usage:
2 Replies
I guess it's the same model that's passed around so it's only loaded once? Check with Debugbar
I’ll try that out thank you
Yeah it’s the same record. Being loaded so hopefully it’s just the once