我的控制器::
$this->data['naskleng'] = json_decode($resource->packages, true);
我的观看::
@forelse($naskleng as $packageDetail)
{!! $packageDetail['package_list]['name'] !!}
@empty
<h1>KUUK</h1>
@endforelse
如果dd($ packageDetail [&#39; package_list])和结果
[{"id":"4h","name":"4 Hours leak","rate":"350000","commission_type":"fixed","commission":"50000"},{"id":"7h","name":"7 Hours","rate":"550000","commission_type":"fixed","commission":"50000"},{"id":"10h","name":"10 Hours","rate":"700000","commission_type":"fixed","commission":"100000"}]
array:11 [▼
"pageTitle" => "Users"
"pageIcon" => "fa-id-card"
"pageSubTitle" => "List of Users in the system."
"windowTitle" => "packages"
"service" => Service {#493 ▶}
"naskleng" => array:1 [▼
0 => array:13 [▼
"id" => 5
"country" => "ID"
"service_id" => 4
"package_id" => 1
"min_rate" => null
"max_rate" => null
"commission_type" => "fixed"
"commission" => null
"min_purchase" => "0"
"package_list" => "[{"id":"4h","name":"4 Hours leak","rate":"350000","commission_type":"fixed","commission":"50000"},{"id":"7h","name":"7 Hours","rate":"550000","commission_type":"fixed","commission":"50000"},{"id":"10h","name":"10 Hours","rate":"700000","commission_type":"fixed","commission":"100000"}] ◀"
"translations" => []
"configurations" => []
"availabilities" => []
]
如何访问package_list数据并将其打印以供查看
id = 4h
name = 4 hour leak
rate = 35000
commission_type = fixed
某种启蒙,智慧,非常欣赏。
答案 0 :(得分:0)
试试这个{!! $ packageDetail [&#39; package_list&#39;] [&#39; name&#39;] !!}
我认为问题在于你错过了一个&#39;在&#34; package_list&#34;之后所以它不起作用
古德勒克!
答案 1 :(得分:0)
尝试
dd($packageDetail['package_list']->name)
谢谢