ITADN

Wrong relation name suggested?

#100Closedjose-bittacora 创建于 2023-02-25
J
jose-bittacoracommented
Hi! First of all for your hard work. When I try to use this package, I get suggestions to fix N+1 problems as expected, but I get results like this: Model: MyPackage\Products\Models\Product => Relation: OtherPackage\Models\VatRate - You should add `with(OtherPackage\Models\VatRate)` to eager-load this relation. This is the relation in Product: ```php public function vatRate(): BelongsTo { return $this->belongsTo(VatRate::class); } ``` When I do that, I get an error (relation does not exist). Why is the package reporting class names instead of relation names? I have been hours trying to figure this out but I have failed. I'm completely sure that I am doing something wrong, but I don't know what it is. The code is working so I guess that the relation is correct. Thank you
关闭于 2024-10-04 5 条评论