我想在我的數據庫更新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