Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

debiprasad's avatar

debiprasad liked a comment+100 XP

4mos ago

why laravel add an extra where condition "foreign key is not null" to hasOne/Many relation?

Old post, but as I had the case, I did some digging I finally went to the source directly, and discovered the reason here

hasMany extends HasOneOrMany, and this check is required in the HasOne case.