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.
Most Important One Word Substitutions | English | SSC CGL/CPO 2022 | Dr. Amit Shishodia | Embibe
Комментарии
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.