我升級到laravel 5.5和Voyager 1.0,並在流浪盒上使用mysql。無法重新創建DataRow在Laravel Voyager中的關係
我想在data_rows表上爲用戶和商店之間的關係添加一個條目。我可以使用Voyager的gui創建條目。
$dataRow = $this->dataRow($storeDataType, 'store_belongsto_user_relationship');
if (!$dataRow->exists) {
$dataRow->fill([
'type' => 'relationship',
'display_name' => 'Manager',
'required' => 0,
'browse' => 1,
'read' => 1,
'edit' => 1,
'add' => 1,
'delete' => 1,
'details' => '{"model":"App\\User","table":"users","type":"belongsTo","column":"manager_id","key":"id","label":"email","pivot_table":"ad_store","pivot":"0"}',
'order' => 20,
])->save();
}
和運行我的數據庫遷移與我自定義的播種機,如果我重新加載/database/stores/bread/edit
網頁,其中創建相應的表項 我得到一個錯誤,用於訪問在這一行觸發的非對象的屬性。
<?php if($relationshipDetails->type == 'belongsTo'): ?><?php echo e('flexed'); ?><?php endif; ?>
這意味着存儲在詳細信息字段中的json無效。我不明白這是怎麼回事,但當我逐字地將它複製到我的播種機上時。是否還有其他一些條目添加到另一個表或緩存中,我的播種器沒有考慮到?我爬過了數據庫條目,找不到任何明顯的東西。
編輯
添加在參考了問題這條線,我發現這是與問題相關的
@php $relationshipDetails = json_decode($relationship['details']); @endphp