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

dogakorkmaz35's avatar

dogakorkmaz35 wrote a reply+100 XP

1mo ago

Retrieving a loaded relationship but do not hit database if missing

@booni3 I know this is old, for anyone else tho, as far as I know Laravel only considers relation "loaded" if you hit the db and load the relationship to that instance, it doesn't track the actual class setters. So you must load the relationship via Eloquent API first to get true from relationLoaded check, not by native PHP.