mardi 5 janvier 2016

Laravel 5: Does Eloquent eager load by default?

I got this structure:

School -> hasMany -> Classes

So when I tried the codes below via artisan tinker

App\School::with('schoolclasses')->find(2283)->schoolclasses;

I can get the classes without problem.

But when I tried without the with I still get the same result without problem:

App\School::find(2283)->schoolclasses;

Does Eloquent eager loads by default? If so, disable it?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire