我正在使用Laravel 5.7开发项目
我有两个数组
我想查看表的这个数组
array(['branch','report','product','cost']);
array(
[
'branch' =>
[
'branch.add',
'branch.delete,
]
'report' =>
[
'report.create',
'report.list,
]
'product' =>
[
'product.add',
'product.sell'
]
'cost' =>
[
'cost.add',
'cost.list
]
]
)
我希望桌子看起来像这样
<table>
<thead>
<th>Branch</th>
<th>Report</th>
<th>Product</th>
<th>Cost</th>
</thead>
<tbody>
<tr>
<td>branch.add</td>
<td>report.create</td>
<td>product.add</td>
<td>cost.add</td>
</tr>
<tr>
<td>branch.delete</td>
<td>report.list</td>
<td>product.list</td>
<td>cost.list</td>
</tr>
</tbody>
</table>
我做了很多尝试,但是无法编写正确的foreach循环。
第一次尝试
<table>
<thead>
<tr>
@foreach($delegateGroup as $group)
<th>{{$group}}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach($delegateType as $delegate)
@foreach($delegate as $v)
<tr>
<td>{{$v}}</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
第一个数组中的第二个数组用于正确结果,但其他数组结果错误
我究竟做错了什么
慕雪6442864
jeck猫