Im coding in a branch to visualize the values that I get from php, and I want the key name of the array to appear above the values.
{% if user.address %}
<tr>
{% for address in user.address %}
{% for parts in address %}
<td width="25%">
{{ parts }}
</td>
{%endfor%}
{% endfor %}
</tr>
{% endif %}
In the part under {% for address in user.address %}I want to put ( {{address.key}}or the real sentence needed to get the array key)
The array is like:
-address : array:4 [▼
"Door" => array:1 [▼
0 => "225"
]
"Street" => array:1 [▼
0 => "Pinky street"
]
"District" => array:1 [▼
0 => "District north"
]
"City" => array:1 [▼
0 => "New York"
]
]
Edit:
Ty for help:
{% if user.address %}
<tr>
{% for key, address in user.address %}
<td width="25%">
{{ key }}
</td>
{%endfor%}
</tr>
<tr>
{% for address in user.address %}
{% for parts in address %}
<td width="25%">
{{ parts }}
</td>
{%endfor%}
{%endfor%}
</tr>
{% endif %}
source
share