【发布时间】:2021-07-18 20:29:33
【问题描述】:
我有数据需要在 Laravel 刀片视图中显示为 3 行,并带有标题。我知道 Laravel 中有 chunk 方法来分块数据并显示。但我想以不同的方式显示数据。
这是我的数据
Illuminate\Support\Collection {#1898 ▼
#items: array:2 [▼
0 => {#1021 ▼
+"parameter": "NH3 Examine"
+"id": 6
+"pond_quality_id": 5
+"parameter_id": 28
+"pond_water_cig": 12
+"pond_water_non_cig": 12
+"taken_actions_cig": 12
+"taken_actions_non_cig": 12
+"taken_actions": "action"
+"measure_before_intervention": "before"
+"measure_after_intervention": "after"
+"remarks": "remarks1"
+"created_at": "2021-04-25 10:16:00"
+"updated_at": "2021-04-25 10:16:00"
}
1 => {#1897 ▼
+"parameter": "O2 Examine"
+"id": 7
+"pond_quality_id": 5
+"parameter_id": 29
+"pond_water_cig": 23
+"pond_water_non_cig": 23
+"taken_actions_cig": 23
+"taken_actions_non_cig": 23
+"taken_actions": "action taken"
+"measure_before_intervention": "before intervention"
+"measure_after_intervention": "after intervention"
+"remarks": "remarks2"
+"created_at": "2021-04-25 10:16:00"
+"updated_at": "2021-04-25 10:16:00"
}
]
}
这是我想要输出数据的方式
| col1 | col2 | col3 | col4 |
|---|---|---|---|
| col1 val1 | col2 val1 | col3 val3 | col4 val4 |
| col1 val2 | col2 val2 | col3 val3 | col4 val4 |
| col5 | col6 | col7 | col8 |
|---|---|---|---|
| col5 val1 | col6 val1 | col7 val3 | col8 val4 |
| col5 val2 | col6 val2 | col7 val3 | col8 val4 |
| col9 |
|---|
| col9 val1 |
| col9 val2 |
我怎样才能做到这一点?
【问题讨论】:
标签: php laravel laravel-views