laravel-performance-eager-loading

Prevent N+1 queries by eager loading; enable lazy-loading protection in non-production; choose selective fields

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "laravel-performance-eager-loading" with this command: npx skills add noartem/laravel-vue-skills/noartem-laravel-vue-skills-laravel-performance-eager-loading

Eager Loading and N+1 Prevention

Load Relations Explicitly

Post::with(['author', 'comments'])->paginate();
  • Use load()/loadMissing() after fetching models when needed
  • Select only required columns for both base query and relations

Guard Against Lazy Loading in Dev/Test

Add to a service provider (non-production):

Model::preventLazyLoading(! app()->isProduction());

Verify

  • Use a query logger or debugbar to confirm relation queries are minimized
  • Add tests that assert counts or avoid unexpected query spikes

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

shadcn-vue

No summary provided by upstream source.

Repository SourceNeeds Review
General

laravel-routes-best-practices

No summary provided by upstream source.

Repository SourceNeeds Review
General

baseline-ui

No summary provided by upstream source.

Repository SourceNeeds Review
General

laravel-internationalization-and-translation

No summary provided by upstream source.

Repository SourceNeeds Review