KeyValue is missing the associative part on edit
I'm using a KeyValue component inside a RelationManager form.
My
error
field contains a json object and is set on a pivot model.
the relationship
On my intermediate model DocumentKyc
I cast the column error
as an array:
When I go to edit my relation the KeyValue field look like the attachment I gave.
Note : I've found a solution by mutating my data before fill :
But shouldn't it recognize the associative array by default ?
Or maybe I'm missing something obvious here...
Anyway, thanks in advance5 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
that screenshot suggests that the keyvalue is recieving a json string, not an array
the problem is that you probably need ->withCasts([‘error’ => ‘array’]) on your relationship?
Oh, I didn't know I had to specify the cast on the relationship as well, since I added the $cast on the pivot model itself (I'm gonna try right away)
i think its a laravel quirk rather than something on our end
Yeah indeed, it works !
As always, thanks a lot 🙂