Matteo G
Explore posts from serverskey-value and json arrays: {closure}(): Argument #1 ($value) must be of type ?string, array given
the import worked! thanks!
just generalized the code a bit to convert all arrays into a comma-separated string to ease the transition of all other models.
35 replies
key-value and json arrays: {closure}(): Argument #1 ($value) must be of type ?string, array given
I didn't make it, it comes from the commonmark packages:
League\CommonMark\Extension\FrontMatter\Data\SymfonyYamlFrontMatterParser
League\CommonMark\Extension\FrontMatter\FrontMatterParser
I'll see if I can find some readable source code
35 replies
key-value and json arrays: {closure}(): Argument #1 ($value) must be of type ?string, array given
I was also thinking of that, but I don't know how hard it would be to change how Laravel handles converting to an array. This is the import script I'm using on the actual website.
getFrontMatter
returns an array representing the frontmatter on a markdown file. It is stored in the database as a JSON column35 replies
key-value and json arrays: {closure}(): Argument #1 ($value) must be of type ?string, array given
hey, thank you so much! Works like a charm on the filament admin!
but now it doesn't load properly on the rest of the website because it gets converted to a string (so looping over it does not work anymore :(). But I could change that section to explode the string it receives, though it seems a bit weird and inefficient (imploding to explode it right after...) ?
They are stored as an array because of the way Eloquent does casts automatically, so i don't know how hard it would be to customize that process...
35 replies
key-value and json arrays: {closure}(): Argument #1 ($value) must be of type ?string, array given
https://github.com/matfire/filament-kv-repro
here it is
35 replies
key-value and json arrays: {closure}(): Argument #1 ($value) must be of type ?string, array given
upping this since I'm still trying to make this work; I tried using mutateFormDataBeforeSave and handleRecordUpdate, but neither gets called before the error is thrown 😦
35 replies
key-value and json arrays: {closure}(): Argument #1 ($value) must be of type ?string, array given
yes, but only on save I think (it displays fine). Is there a way to handle saving this field manually ? I thought maybe mutateFormDataBeforeSaving would work, but it does not even trigger, it seems
35 replies
key-value and json arrays: {closure}(): Argument #1 ($value) must be of type ?string, array given
ah, and is there no way to convert it to and from an array on save ? I've been trying to use mutateFormDataBeforeSave, but it doesn't look to be triggering ?
35 replies
Getting owner record in custom association action
got it, I just used
$this->getOwnerRecord()
and then attached the value with the extra values for the pivot table xD
Is there another way that would allow me to avoid overriding this behaviour, though ? I have many relationships with this kind of requirements...4 replies