Support the ongoing development of Laravel.io →
posted 10 years ago
Eloquent
Last updated 2 years ago.
0

You can loop through results as below. You can then compare the show_year against the previous iteration in the loop to determine if you should echo another year heading.

foreach($shows as $show)
{
    // echo show name

    foreach($show->showrefs as $ref)
    {
        // echo ref information
    }
}
Last updated 2 years ago.
0

Thanks iWader, makes sense. Where would all of this occur, in the controller or the view? Is it a case of this happens in the controller and you make it an array/collection, and then foreach again in the view?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.