Skip to content

Inconsistant Cast Behavior for Eloquent #8972

@ragingdave

Description

@ragingdave

When using the fill method, any $casts are ignored. Ex.

'valid' => 'boolean'

Works:
$object->valid = 'something'; // Will convert to a 1 for database storage

Doesn't work:
$arr = ['valid' => 'something'];
$object->fill($arr); // will stay as 'something'

Temporary Fix is just to make a setValidAttribute($valid) mutator but I would think that in order to have consistent behavior across the board, $casts should be respected anyway that attributes can be set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions