Skip to content

markApproved, markRejected, ... functions incompatible with models with attributes with array casts #35

@koapeadu

Description

@koapeadu

I have a model with an array cast on one attribute foo.

protected $casts = [
        'foo' => 'array',
];

But the SQL type is VARCHAR.
When the any of markApproved, markRejected, markPostponed, markPending is called, it causes the attributes array to be changed from

$attributes = [
    ...
    'foo' => '["mango","pineapple","pawpaw"]'
    ...
]

to

$attributes = [
    ...
    'foo' => [
        "mango", "pineapple", "pawpaw"
    ]
    ...
]

which leads to unexpected value exceptions when trying to save the model

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions