Closed merijnponzo closed 1 year ago
I changed my model_type to \Page but it's still not showing up
Okay after hours of debugging it looks likes my structure wasn't 1:1 The images should be stored into an array, while i was migrating one image as an object
if ($image_key) {
//
$randomStringTwo = Str::random(16);
$new_block = [
"key" => $randomStringTwo,
"layout" => "largevisual",
"attributes" => [
"media" => [
[
// add collection key to image
"key" => $image_key,
"layout" => "medialayout",
"attributes" => [
"link" => null,
"title" => null
]
]
],
"title" => null,
"heading" => null
]
];
array_push($new_content, $new_block);
}
now it's working
I am trying to migrate content into flexible content with spaties media library
I first checked how the structure of my flexible field looks like whenever uploading an image: Json in my table column 'content'
And the related image:
So after the migration it looks 1:1 similar (except for the key, this will be different with every image)
I created key with Str helper like "cOhwRSY5LrTK06mp" and added them to my spatie image so the key of my related image is the same.
However, after the migration i can see all the 'largevisual' blocks, but no images are attached. And when i press update the media attribute get's empty.
The image key like "cOhwRSY5LrTK06mp" only occurs in my media table and my pages table. Am i missing something ?
Any help appreciated