Using Laravel 5.6. I have JSON field called metas
Inserting and Updating works as expected except 1 thing: if field doesn't exist in metas
it will not be created on update or updateOrdCreate methods. Fields that exist updating without problem.
Here is excample metas
content:
{
"date": "2018-09-17",
"name": "r08"
}
I can update "date" and "name", but there will be some situations where I need to add new field for excample "distance", I can't do this:
Registries::where('id', $registry_id)->update([
'metas->distance' => '200km'
]);
Also tried:
Registries::where('id', $registry_id)->updateOrCreate([
'metas->distance' => '200km'
]);
No errors.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire