Support #[With] attribute for default eager loading as alternative to $with property #57639
Unanswered
sediqzada94
asked this question in
Ideas
Replies: 1 comment 15 replies
-
|
Taylor seems to be slowly losing his "appetite" for attributes, but it would be worth a try |
Beta Was this translation helpful? Give feedback.
15 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, Laravel only supports the
protected $withproperty for specifying default eager loaded relationships in Eloquent models. With PHP 8's attributes gaining wider adoption, it would be beneficial to have an attribute-based alternative for better code organization and modern PHP practices.Proposed Solution
Add support for a
#[With]attribute that works alongside or as an alternative to the$withproperty:What do you guys think?
Beta Was this translation helpful? Give feedback.
All reactions