laravel-auditing icon indicating copy to clipboard operation
laravel-auditing copied to clipboard

Attribute modifiers for array-casted fields

Open zlodes opened this issue 4 years ago • 0 comments

Q A
Bug? no
New Feature? yes
Framework Laravel
Framework version 7.29.0
Package version 11.0.0
PHP version 7.4.10

It will be very handy to have attribute modifiers for fields casted to array.

Example:

protected $casts = [
    'credentials' => 'array', // jsonb
];

protected $attributeModifiers = [
    'credentials.password' => RightRedactor::class,
];

Before modifications:

[
    'email' => '[email protected]',
    'password' => 'Pa$$w0rd',
]

After modifications:

[
    'email' => '[email protected]',
    'password' => 'Pa******',
]

zlodes avatar Nov 05 '20 12:11 zlodes