Support the ongoing development of Laravel.io →
Database Eloquent

Can someone confirm that this is intended behaviour?

In a model Text I have this relationship:

public function textI18Ns()
{
    return $this->hasMany('\Models\TextI18N', 'textId'); 
}

I load all texts of an object with eager loading like this (note the lowercase of textI18Ns):

$general->texts()->with('textI18Ns')->rememberForever()->orderBy($orderby, $orderdirection)->get();

With the following code i have NO extra queries, like intended.

$texti18n = $text->textI18Ns;

But with the following code there are extra queries (It was a typo, but it doesn't throw an exeption?).

$texti18n = $text->TextI18Ns;
Last updated 3 years ago.
0

may be collection doesn't throw anything due to keep te code work without an error and keep in mind, invalid properties is NULL. #cmiiw

0

Sign in to participate in this thread!

Eventy

Your banner here too?

KevinM86 kevinm86 Joined 3 Feb 2014

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.

© 2025 Laravel.io - All rights reserved.