Attribute aliases #42488
Unanswered
MichelJonkman
asked this question in
Ideas
Attribute aliases
#42488
Replies: 2 comments 5 replies
-
what would be the difference with the public function getIdentifierAttribute(): string
{
return $this->attributes['id'];
} |
Beta Was this translation helpful? Give feedback.
1 reply
-
@99michel99 in model you can overwrite method __get and set to implemnt Attribute aliases |
Beta Was this translation helpful? Give feedback.
4 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.
Uh oh!
There was an error while loading. Please reload this page.
-
A request to add attribute aliases to models. An attribute alias would act just like a normal attribute but with a different name.
The implementation would probably have to be in Illuminate\Database\Eloquent\Concerns\HasAttributes and be fairly simple.
Let me know what you think!
Edit: I had switched the key and value around accidentally, fixed that.
Beta Was this translation helpful? Give feedback.
All reactions