mwal mwal - 1 year ago 107
PHP Question

View partials - duplicating queries?

If I have a partial which always needs the same data (say to fill out some nav links) and I provide the data in a view composer, do I need to worry about cases where the main page has already got this data because it needs it itself?

i.e. is it possible to end up calling for the same data twice?
(a potential gotcha in using view composers?) does this matter? Am I "pushing the framework?"

Answer Source

short answer is yes, you might call for the same data twice.

try adding


before any database calls, and in the end, before the view is returned, do this:


Then you can see if you are calling the same data twice, in the query log.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download