Don’t use the named data key, just pass a single entry or an array of entries. Your example results in an entry with a single field named “data” and then the “title” is missing.
// single entry
$return = cockpit('collections')->save('blog',
[
'published' => true,
'slug' => $posts[1][10],
'date' => $posts[1][1],
'title' => $posts[1][2],
// ...
]
);
or:
// multiple entries - syntax works with single entry, too
$return = cockpit('collections')->save('blog', [
[
'published' => true,
'slug' => $posts[1][10],
'date' => $posts[1][1],
'title' => $posts[1][2],
// ...
],
[
'published' => true,
'slug' => $posts[2][10],
'date' => $posts[2][1],
'title' => $posts[2][2],
// ...
]
]);
See also: