Can't figure out why JSON field is being ignored.
This one doesn't work:
Registries::create([
'nr' => $old_document->no,
'metas->name' => 'r01',
]);
In model I have set:
protected $casts = [
'metas' => 'array',
];
And:
protected $fillable = [
'nr',
'metas'
];
I think the problem is in attributes casting, because this one is working:
Registries::create([
'nr' => $old_document->no,
'metas' => json_encode(['name'=>'r01']),
]);
I'm not getting any errors just JSON column stays empty.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire