Skip to content

Alert advice text #17

@janpio

Description

@janpio

Just started using this package ❤️

The alert says:

Found the following N+1 queries in this request:

Model: App\Balance => Relation: statement - You should add "with('statement')" to eager-load this relation.

Although it is great that the package tries to give advice (You should add "with('statement')" to eager-load this relation.), this might be "misleading":

What is actually happening in my code is a loop over $account->balances->groupBy('statement_id') (as $balances) where $balances[0]->statement is called. In this case the correct solution was adding $account->load('balances.statement');

Maybe there is a way to formulate the alert in a more code independent way that keeps it useful?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions