data from Api after request
array:1 [▼
"id" => 1
"name" => "test"
"active_domain" => "https://drycleaner.com"
"domains" => array:1 [▶]
"rr" => array:2 [▼
0 => array:1 [▼
0 => array:1 [▼
"end_at" => "2020-11-08T08:00:00.000+08:00"
]
]
1 => array:1 [▼
0 => array:1 [▼
"end_at" => "2020-11-08T08:00:00.000+08:00"
]
]
]
]
php laravel blade.view
@foreach ($store["rr"] as $key2=>$rr){
@foreach ($rr["rss"] as key3 =>$rss)}
<td>{{ date("d-M-y H:i", strtotime($rss["end_at"])) }}</td>
@endforeach
Undefined end_at error. I think its a problem with the foreach coluumn naming. How can I grab from api which is "end_at" and insert into the table.
end_at
key is on second array of $dr
. You need to call foreach again or use key directly like $dssl[0]["end_at"]
:
<td>{{ date("d-M-y H:i", strtotime($dssl[0]["end_at"])) }}</td>
or using foreach
@foreach ($store["dr"] as $key2=>$dr){
@foreach ($dr["dssl"] as key3 =>$dssl)}
@foreach ($dssl as key4 =>$dss)}
<td>{{ date("d-M-y H:i", strtotime($dss["end_at"])) }}</td>
@endforeach
@endforeach
@endforeach
in the blade syntax you have to close every foreach:
@foreach ($store["dr"] as $key2=>$dr){
@foreach ($dr as key3 =>$dssl)}
<td>{{ date("d-M-y H:i", strtotime($dssl["end_at"])) }}</td>
@endforeach
@endforeach
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.