从laravel刀片文件访问阵列数据的问题
@foreach($connbid as $conaccept)
{{$conaccept->contributer_id}}<br>
@foreach($conaccept['accept'] as $acceptpost)
{{ $acceptpost->bidpost_id }}<br>
{{ $acceptpost->customerpost->vehicle_booking->id }} //problem in accessing this
data from blade
@endforeach
@endforeach
原始json是:
[
{
"id": 1,
"contributer_id": 2,
"post_id": 1,
"created_at": "2019-10-23 16:31:52",
"updated_at": "2019-10-23 16:31:52",
"accept": [
{
"id": 2,
"user_id": 1,
"customerpost": {
"id": 1,
"customer_id": 1,
"vehicle_booking": {
"id": 1,
"vcustomeraccept": {
"id": 1,
"created_at": "2019-10-23 16:15:42",
"updated_at": "2019-10-23 16:15:42",
"customeraccept": null
}
}
}
}
]
]
答案 0 :(得分:1)
如果$conaccept
是一个数组,请尝试更改
$conaccept['accept']
上
$conaccept->accept