Performance: Polymorphic relationships
MEDIUM IMPACT
This affects database query performance and page load speed by influencing how many queries and joins are executed.
Post::with('comments')->get();
Post::all()->each(fn($post) => $post->comments);
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Lazy loading polymorphic relations | Minimal DOM impact | Minimal | Minimal | [X] Bad - causes multiple queries delaying content |
| Eager loading polymorphic relations | Minimal DOM impact | Minimal | Minimal | [OK] Good - reduces queries and speeds data availability |