Eloquent's New Chaperone Method

preview_player
Показать описание
The latest version of Laravel 11 ships with a new chaperone method for Eloquent models. Cutely named, it solves an N+1 problem that likely every one of us has encountered at some point or another.

Рекомендации по теме
Комментарии
Автор

Jeffrey really has a knack for educating complete beginners like me😅. Bravo🎉

jonathanjohnson
Автор

Are you planning to discuss all the new features that were announced at the recent Laracon? That's much needed now.

im-nazmul
Автор

Love your videos, here and at laracast.

fakerealnews
Автор

Can't we just return $series->title immediately inside the map function?

tariksadiku
Автор

I updated to 11.22 because it happened to be the feature I was needing at the moment. It's not that we don't know how to do it manually. The point is that it's easy to forget to do it and end up with the n+1 query problem. It's just handy. And about the naming: I think that "goAlong" would be nice too:

erickdeazevedolima
Автор

Hmm I would probably just pass the $series model to the map callback function with use($series)

eyemazed
Автор

Why wouldn't you want to have this on all the time? What is the disadvantage?

nielskok
Автор

Besides applying it to the episodes, do we need to apply it to the inverse relation (series)?

RodrigoMendoza
Автор

jeffrey, yes we need to know the internals please

grise
Автор

so let me get it strait, from what i see chaperone remove one extra loop meaning it's setting the relation object on episodes collection instantiation instead of creating the collection and then looping it and setting the rel.

SXsoft
Автор

Wouldn’t the $with property on the model do this ?

jasonennis
Автор

Quick question, is chaperone() available only for hasMany relationships or can we use it for belongsToMany(), if we can't, anyone knows why?

draiczon
Автор

What's the music in intro wanna make that my ringtone so catchy.

pratikbhujel
visit shbcf.ru