I wanted to group all the matching values that are same in each table. If the value is 1 and have 3 1s then , show all 3 rows of 1s in first table. Now, if i have 2 as a value and occurring 5 times, then show 5 rows of 2 in the second table?
I wanted to group them with the city and then all the drivers that are same in one table, then once finished, get all the second driver in the second table (under the same city).
Please see the code below:
@foreach ($areas as $area)
@if (area->city == "Melbourne")
<h1>Melbourne</h1>
<table class="table">
<thead>
<tr>
<th scope="col">DriverID</th>
<th scope="col">City</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Melbourne</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Melbourne</td>
</tr>
<tr>
<th scope="row">1</th>
<td>Melbourne</td>
</tr>
</tbody>
</table>
<br>
<table class="table">
<thead>
<tr>
<th scope="col">DriverID</th>
<th scope="col">City</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">2</th>
<td>Melbourne</td>
</tr>
</tbody>
</table>
<br>
<table class="table">
<thead>
<tr>
<th scope="col">DriverID</th>
<th scope="col">City</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">3</th>
<td>Melbourne</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Melbourne</td>
</tr>
</tbody>
</table>
<hr>
<h1>Perth</h1>
<table class="table">
<thead>
<tr>
<th scope="col">DriverID</th>
<th scope="col">City</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">2</th>
<td>Perth</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Perth</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Perth</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Perth</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Perth</td>
</tr>
</tbody>
</table>
@endif
@endforeach
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2BZzcN8
via IFTTT
Aucun commentaire:
Enregistrer un commentaire