laravel / blog-contest-may-mayhem

242 stars 16 forks source link

How to solve the n+1 problem introduced by fractal #7

Closed ghost closed 4 years ago

ghost commented 6 years ago

https://medium.com/@giuvara.alex/how-to-solve-the-n-1-problem-introduced-by-fractal-7ba7936b8b81

DarkGhostHunter commented 6 years ago

Also, if you’ve got a moment, please vote for this article in the Laravel Blog competition: leave a “👍” emoji reaction on the issue corresponding to the this post.

I recommend you to remove that line. The contest states that:

To be fair to those with smaller audiences, you may not lobby for votes via Twitter, etc.

ghost commented 6 years ago

@DarkGhostHunter I have no idea what you’re talking about. What line?

pavankataria commented 4 years ago

How does that solve the problem with Fractal? This just says to use another solution which some of us may not be able to refactor right away.

ghost commented 4 years ago

@pavankataria well, you have to replace fractal with native Eloquent Resources, which are similar to transformers, with the difference of requesting the DB relation only when is requested (whenLoaded()).

The article's main focus is the n+1 problem, not the fractal package.