I have a report page that loops through a collection and displays the data in a generic bootstrap template table - it's showing data about users, and one user can have multiple rows in the table. I group the rows by the user ID and I want to basically stripe the table rows based on the user ID (not just alternating rows). So, for example, I might display 4 rows for user ID = 5 with a white background and then 2 rows for user ID = 6 with a gray background. I'd just use a local variable in straight php, but is there an elegant/clean way to do this in the blade templates?
@foreach($payments->getDetails() AS $k=>$detail)
<tr>
<td></td>
<td>$</td>
<td></td>
</tr>
@endforeach
In this example, $payments is a collection of $paymentsDetails objects. So based on the $detail->payment->userid value I'd like to determine the class or background color.
Thank you for any help in this.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kD27rY
via IFTTT
Aucun commentaire:
Enregistrer un commentaire