Pluck method does not respect Attribute return type mutators #54114
-
When using the magic accessor methods on a model then the public function getNameAttribute(): string
{
return strtolower($this->name);
} However, when using the public function name(): Attribute
{
return Attribute::make(
get: fn (string $value) => strtolower($value)
);
} Looking into the src/Illuminate/Database/Eloquent/Concerns/HasAttributes::hasGetMutator method_exists($this, 'get'.Str::studly($key).'Attribute') This seems like it would be fixed by applying the Is there a reason that this is not implemented this way? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi. This seems like a bug/partial implementation for the new version of mutators. |
Beta Was this translation helpful? Give feedback.
Hi. This seems like a bug/partial implementation for the new version of mutators.