Let's say we have a user with parameters field like this:
User::first()->parameters
=> [
"pins" => [
1,
],
]
Now I want to add another pin to have something like this:
User::first()->parameters['pins']
=> [
2,
1,
]
Currently I'm doing this with the following query:
User::first()->update(['parameters' => ['pins' => array_merge([2], User::first()->parameters['pins'])]])
I was wonder if there is any Eloquent way to do that without fetching the pins first (I mean without User::first()->parameters['pins']). Because mysql suport it with JSON_ARRAY_APPEND()