Laravel V11.22 Released With Chaperone Eloquent Relations And More
Laravel v11.22 released with chaperone() Eloquent method, backed Enum support in Queuable methods & route name/domain methods, and more.
The Laravel team released v11.22 this week, with the chaperone() Eloquent method for inverse relations, support for passing backed Enums to Queuable methods, the ability to pass backed Enums to route ->name() and ->domain() methods, and more.
#Chaperone Eloquent Relations
Samuel Levy contributed the Eloquent inverse/chaperone model relation that Taylor demonstrated in his 2024 Larcon US keynote during the open-source part of the talk.
public function comments(): HasMany{ return $this->hasMany(Comment::class)->chaperone('post');}
The chaperone()/inverse() method avoids unexpected N+1 queries...