回答編集履歴
2
命題に合わせて修正
test
CHANGED
@@ -9,3 +9,29 @@
|
|
9
9
|
|
10
10
|
|
11
11
|
こんな感じで、コレクションクラスの`groupBy`メソッドを使って、グループ化すれば、Bladeでも書きやすいでしょう
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
```php
|
16
|
+
|
17
|
+
@foreach($grouped as $location => $group)
|
18
|
+
|
19
|
+
<tr>
|
20
|
+
|
21
|
+
@foreach($group as $school)
|
22
|
+
|
23
|
+
@if ($loop->first)
|
24
|
+
|
25
|
+
<td rowspan="{{ count($group) }}">{{ $school->location1 }}</td>
|
26
|
+
|
27
|
+
@endif
|
28
|
+
|
29
|
+
<td>{{ $school->location2 }}</td>
|
30
|
+
|
31
|
+
@endforeach
|
32
|
+
|
33
|
+
</tr>
|
34
|
+
|
35
|
+
@endforeach
|
36
|
+
|
37
|
+
```
|
1
命題に合わせて修正
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
$schools = School::query()->get();
|
4
4
|
|
5
|
-
$grouped = $schools->groupBy('school_a
|
5
|
+
$grouped = $schools->groupBy('school_location1');
|
6
6
|
|
7
7
|
```
|
8
8
|
|