-
|
Can I insert a string, "object", into a document with save()? When I do that, it creates ObjectId, created_at and updated_at only. |
Beta Was this translation helpful? Give feedback.
Answered by
zigzagdev
Dec 16, 2025
Replies: 1 comment
-
|
Hey — I feel your pain. Please try this.
So, if you want to make a new record , Model::create([
'store' => [
'id' => 1,
'name' => 'Store1',
'theme' => [
'colors' => [
'text' => ['primary' => '#683E9D', 'secondary' => '#1a202c'],
'header' => ['primary' => '#683E9D', 'secondary' => '#1a202c'],
'pallete' => ['primary' => '#683E9D', 'secondary' => '#1a202c'],
],
],
'domain' => 'shop.domain.com',
'status' => 1,
'subdomain' => null,
'store_code' => 'bd51d5e4-a0d6-4944-a9cc-8586c6b0c49c',
'is_marketplace' => 1,
'iframe_google_maps' => null,
],
]);Hope this helps !! 🙌 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
GromNaN
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
。@gvillela7
Hey — I feel your pain.
Please try this.
save()is an instance method, soModel::save([...])won’t work the way you expect.Also, the payload in your example uses JS object syntax. In PHP it must be an associative array (
=>).So, if you want to make a new record ,
create()please try this method !!