Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 1 year ago.
0

Considering this one screen, you have many queries based on the same data, fetch once, filter later. I wouldn't worry about traffic crashing your app, that's what cache is for and will help with continues DB calls.

What do you mean 80 views rendered? You load 80, separate views/compositions for a single page?

Last updated 1 year ago.
0

I meant I have on feed with 10 posts on it, each posts can have up to 5 comments. so each post is a view, each comment is a view. so only this small this is 60 views....

Last updated 1 year ago.
0

It should be fine as long as you don't make another sql query for each "view".

Belar said:

fetch once, filter later.

Fetch the data once, then filter it. Then loop through the filtered data.

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

tzookb tzookb Joined 9 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.