Why don’t the new class-based Laravel Eloquent accessors apply with `->pluck(‘name’)` as they did with the old magic methods?

I’m working on a Laravel (and FilamentPHP) project and noticed a discrepancy between the old “magic” accessor method and the new class-based Attribute accessor introduced in Laravel 8.40+. Specifically, when I use:

Model::query()->pluck('name', 'id')
  • The old magic accessor (getNameAttribute()) applied ucwords() to the plucked values.
  • The new class-based accessor (protected function name(): Attribute) does not apply the transformation when plucking.

Here’s a simplified example of my model:

<?php

namespace AppModels;

use IlluminateDatabaseEloquentCastsAttribute;
use IlluminateDatabaseEloquentBuilder;
use IlluminateDatabaseEloquentModel;
use AppEnumsSomeEnumStatusState;

class MyModel extends Model
{
    // OLD Magic Accessor (works with pluck)
    // public function getNameAttribute($value)
    // {
    //     return ucwords(strtolower($value));
    // }

    // NEW Class-based Accessor (not applying with pluck)
    protected function name(): Attribute
    {
        return Attribute::make(
            get: fn ($value) => ucwords(strtolower($value))
        );
    }

    public function scopeOpen(Builder $query): Builder
    {
        return $query->where('state', SomeEnumStatusState::OPEN);
    }

    protected function casts(): array
    {
        return [
            'state' => SomeEnumStatusState::class,
        ];
    }
}

And in my FilamentPHP Resource:

FormsComponentsSelect::make('model_id')
    ->label('Status')
    ->relationship('modelRelationship', 'name')
    ->options(MyModel::query()->pluck('name', 'id')),

My questions are:

  1. Why does Model::query()->pluck('name', 'id') return the raw database values when using the new class-based name(): Attribute but returns transformed values under the old getNameAttribute() method?

  2. Is this the intended behavior, or am I missing something about how pluck() interacts with the newer Attribute accessors?

  3. What is the recommended or “best practice” way to retrieve transformed attribute values (especially with FilamentPHP) under the new accessor approach?

Any insights, explanations, or code examples showing how to ensure pluck() respects the class-based accessor would be greatly appreciated!