Open francescomalatesta opened 1 year ago
Did you figure this out?
Edit:
I've added the following to my CustomFlexibleCast
and this appears to temporarily fix the issue:
public function set($model, string $key, $value, array $attributes)
{
$serializedBlocks = Collection::wrap($value)->map(function ($block) {
return is_array($block) ? $block : [
'layout' => $block->name(),
'key' => $block->inUseKey(),
'attributes' => $block->getAttributes()
];
})->toArray();
return json_encode($serializedBlocks);
}
Hi everyone! I am going crazy with this one; I hope you can help me :pray:
I am working with Laravel 10 and Nova 4. I have a model called Pipeline that I manage with Nova for CRUD operations. One of its fields is called sources, and I used FlexibleContent to make it... flexible :D
I am using the suggested cast in the model:
When I work with Nova, everything is alright. Here's an example of a value I see in my column.
Sometimes I need to edit this model. Not the sources field, that is always and only managed by Nova, but other unrelated fields. Whenever I make these edits and save the model, the value in sources appears like it was reset:
Just to give you an idea, the code making the edit is like
As you can see, the sources field is not mentioned at all. But after that save call, its value is changed (in a breaking way for my code).
Every tip/hint is welcome :pray: Thanks a lot for your time!