• CRITICAL
  • REFACTOR
  • REVIEW
  • CLEAN

How to detect Laravel N plus one queries with your agent

Connect your agent to your codebase to catch expensive database loops. Your agent scans your Eloquent models to find where lazy-loading is killing your performance.

Ask AI about this page

Our technology reaches across leading technology and enterprise teams.

  • Amazon
  • NVIDIA
  • Red Hat
  • Fidelity Investments
  • Intuit
  • OLX Brasil
  • Writesonic
  • Artium
  • Trolley
Bunny World Voxel Workspace

Short answer

How do I find N plus one queries in Laravel?

Your agent scans your Eloquent models and controllers to find where lazy-loading triggers excessive database hits. It identifies the exact lines where you need to use eager loading. You'll get a list of problematic relationships and the code to fix them.

Where your fixes land.

The outcomes of your scan.

Your agent categorizes each discovery into actionable buckets.

CRITICAL

Immediate bottlenecks

Your agent finds high-impact loops that will slow down your app under load. You get the specific model and relationship causing the lag.

REFACTOR

Code improvements

These are subtle lazy-loading issues that drag down response times. Your agent provides the specific with() calls to add to your queries.

REVIEW

Human verification

Your agent flags complex or nested relationships it can't confidently refactor. You decide if the suggested eager loading is safe for your data.

CLEAN

Optimized code

Once you apply the fixes, your agent confirms the relationship is now eager-loaded. This ensures your database hits stay constant.

The workflow

What your agent does when the code arrives.

Your agent acts as a specialized static analysis tool for your Eloquent logic.

  1. Scan relationships

    Your agent reads your Eloquent models to map out how data is connected. It looks for patterns where a loop calls a relationship property.

    validate_laravel_excellence
  2. Identify loops

    It traces controller logic to see if you're iterating over collections while accessing un-loaded relations.

    validate_laravel_excellence
  3. Suggest eager loading

    Your agent writes the specific eager loading syntax needed to fix the detected issue.

    validate_laravel_excellence
  4. Verify fixes

    Your agent re-checks the updated code to ensure the N plus one pattern is gone.

    validate_laravel_excellence

Vinkius Agentic Execution Platform

State the outcome. Agents take it from there.

You don't have to drive this run by hand. Inside the Vinkius Agentic Execution Platform, agents pick up the task above and carry it to the end: you set the limits, you watch the steps, you keep all decisions.

Run it in Vinkius

Agents carry the task to the end

Agents execute Laravel Excellence Prover tasks from end to end inside the Vinkius Agentic Execution Platform: set the outcome, and the steps run.

Take it to any compatible AI

One connection, any client

Same connection follows you to ChatGPT, Claude, Gemini and any other client you love. Switch whenever you want: your connection, your permissions and your record move with you.

Spaces

One Space per activity

A Space gathers the context, tools and tasks of one activity, so you coordinate several agents at once and follow each execution as it happens.

Limits

Autonomy inside limits you set

Permissions and spending limits are yours to define. Agents halt for your approval on anything sensitive, and you choose how far autonomy goes, step by step or end to end.

Record

All steps, on the record

Each action your agents take lands in a signed audit trail. Results are verified, mistakes are learned from, and an emergency stop is one click away.

Models

Included in your plan

A curated selection of AI models is included in your plan, and you can add your own through BYOK whenever you prefer.

Try it

Copy these to start.

Use these prompts to kick off the analysis.

Starting points

Replace the bracketed text with your actual file paths or model names.

Laravel Excellence Prover Connector

You're all set. Choose your MCP client and follow the setup instructions.

Connector linkhttps://edge.vinkius.com/vk_preview_xVT6WxKnn5P5RXCAVRvEGptio7bgnTnovi5pfdfY/mcp

Claude Desktop

Follow the steps below to connect in seconds.

  1. 1In Claude Desktop, open Settings → Connectors.
  2. 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
  3. 3Click Add and start a new chat, Laravel Excellence Prover capabilities are ready to use.
Configuration · claude_desktop_config.jsonCopy
{
  "mcpServers": {
    "laravel-excellence-prover-mcp": {
      "url": "https://edge.vinkius.com/vk_preview_xVT6WxKnn5P5RXCAVRvEGptio7bgnTnovi5pfdfY/mcp"
    }
  }
}
Copy into chat04
  • 01

    Scan my User model and its relationships for N plus one issues.

  • 02

    Check the Controller in app/Http/Controllers/OrderController.php for lazy-loading bottlenecks.

  • 03

    Review this loop in my recent pull request and suggest eager loading fixes.

  • 04

    Find all places in the Product repository where I'm missing eager loading on the Category relationship.

  • Claude
  • ChatGPT
  • Cursor
  • VS Code
  • Windsurf
  • Claude Code
  • JetBrains
  • Cline

Start here

Connect Laravel Excellence Prover once, then ask.

Link the MCP to your client. Your credentials stay encrypted, and you can start querying your code immediately.

Connect Laravel Excellence Prover to your agent

FAQ

How this task behaves.

  • 01

    Can your agent automatically rewrite my files?

    No. Your agent identifies the issues and suggests the code, but you must manually apply the changes to your files.

  • 02

    Does it scan my entire database?

    No. It only analyzes your Eloquent models and the code that interacts with them.

  • 03

    Will it find issues in raw SQL queries?

    No. This tool is specifically designed to find N plus one issues caused by Eloquent lazy-loading.

  • 04

    Can it fix performance issues in my migrations?

    No. It focuses on application-level logic and relationship loading, not database schema optimization.

  • 05

    How does it know which relationships are loaded?

    It analyzes the code execution paths and model definitions to determine if a relationship is being called on a collection without being eager-loaded.

  • More questions about Laravel Excellence Prover? The Connector page answers them. See everything the Laravel Excellence Prover Connector can do

Building with AI? Ship this whole workflow in your product.

Vinkius Connect is the connectivity layer for AI builders. All the capabilities used on this page, from Laravel Excellence Prover to thousands more, arrive through one SDK, already maintained for you. One Application, unlimited seats, each with their own connectors and credentials, isolated and never exposed to Vinkius. No OAuth flows to write, no tokens to store, no APIs to chase.

Explore Vinkius Connect

TypeScript · Python · Java · Go · C# · PHP · Rust

  • 01

    Your customers bring their own keys.

    Each user connects their own apps and keeps their own credentials. Vinkius only sees the identifier your backend sends.

  • 02

    Whole catalog, kept current.

    Laravel Excellence Prover plus thousands more, maintained and growing daily. No integrations to write, no token storage, no OAuth plumbing.

  • 03

    Any agent, any model.

    Capabilities land as framework-neutral objects, with adapters for OpenAI, Anthropic, Gemini, the Vercel AI SDK, LangChain and more.

Connect Laravel Excellence Prover to Claude, Cursor, ChatGPT & more

From idea to done

See what gets done when the agents take over the busywork

Each workflow on this page runs on the same platform. Connect your tools once, and your agents keep working in any AI you trust.