Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

Edit seems bugged, so im gonna write the edit here:

Eloquent is referencing parent_user in the sub-query but it isn't using it for the confirmed column. Anyone knows why eloquent is doing this or how I can fix this?

Last updated 2 years ago.
0

Why?
Probably because of the withPivot inside the childs().
How to fix it?
You could remove the withPivot, and instead of has('child') use

->whereHas('childs', function($shildsQuery){
    $childsQuery->where('comfirmed', '=', true);
})->...

You can also try make a scope for the confirmed column. Maybe it will work solve your problem.

Last updated 2 years ago.
0

Hello,

I have the same problem. Did you find any solution for this?

Thank you!!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.