我想在我的数据库更新JSON列,但我得到这个错误:Laravel雄辩不更新JSON柱:数组字符串转换
Array to string conversion
我已经宣布了列名作为array
型号:
protected $casts = [
'destinations' => 'array'
];
这是我使用的代码:
$data[] = [
'from' => $fromArray,
'to' => $toArray
];
Flight::where('id', $id)->update(['destinations' => $data]);
我该怎么办?
试试这个:'$ =飞行飞行::发现($ ID); $ flight-> destinations = $ data; $ flight-> save();'see [here](https://github.com/laravel/framework/pull/15464) – Maraboc
@Maraboc发布您的答案请 – Ramin