Currently, when the Audit functionality formats data, it fails to detect and include attribute accessors of type "Attribute" during the formatting process. As a result, attribute accessors are not considered when formatting the data.
Expected Behaviour
It is expected that the Audit functionality should include attribute accessors of type "Attribute" during the data formatting process. This would ensure that any custom formatting defined through attribute accessors is properly considered.
Steps to Reproduce
Assume we have a model Foo with a JSON attribute, bar, casted as an ArrayObject:
class Foo extends Model implements Auditable
{
protected $casts = [
'bar' => AsArrayObject::class,
];
}
Before fetching the bar attribute, we add custom formatting using an attribute accessor:
public function bar(): Attribute
{
return Attribute::make(
get: fn ($value) => // Some custom formatting
)
}
The Audit functionality currently ignores this custom formatting because it only checks for attribute accessors starting with get, such as getBarAttribute.
Actual Behaviour
Currently, when the Audit functionality formats data, it fails to detect and include attribute accessors of type "Attribute" during the formatting process. As a result, attribute accessors are not considered when formatting the data.
Expected Behaviour
It is expected that the Audit functionality should include attribute accessors of type "Attribute" during the data formatting process. This would ensure that any custom formatting defined through attribute accessors is properly considered.
Steps to Reproduce
Foo
with a JSON attribute,bar
, casted as anArrayObject
:Before fetching the bar attribute, we add custom formatting using an attribute accessor:
The Audit functionality currently ignores this custom formatting because it only checks for attribute accessors starting with get, such as getBarAttribute.