laravel-query-detector icon indicating copy to clipboard operation
laravel-query-detector copied to clipboard

How to solve this error?

Open perffy opened this issue 4 years ago • 2 comments

Hi guys,

I have just installed the package and have already resolved some issues. Unfortunately, I don't know how to solve that:

Found the following N+1 queries in this request:

Model: App\\Domains\\Country\\Models\\Country => Relation: App\\Domains\\Country\\Models\\CountryTranslation - You should add "with(\'App\\Domains\\Country\\Models\\CountryTranslation\')" to eager-load this relation.')

In the place where I call $country, I am already making eager-load like this:

Country::with('translations')->where('abbreviation', '=', $params['code'])->first();

How can I solve that?

perffy avatar Jun 12 '21 12:06 perffy

Have you solved it? It happens to me too

Temepest74 avatar Dec 13 '21 17:12 Temepest74

no, it is still unresolved :(

perffy avatar Dec 13 '21 21:12 perffy