so you do the query (as you suggest) order them...
do a loop, create a ul list... and each time check if is_main_link is true.. if not then close the list and open a new one..
you could do this in controller ie when you get the data back, process it there so in view you already have two arrays/lists
That could be done for individual events, but what about an index page that shows all events?
The general structure that I currently have is @foreach ($events as $event) → @foreach ($event->links as $link) → {{ link_to($link->url, $link->link_title) }}
I decided instead to remove the is_main_link
flag and instead opt to have a single link for registration (which would usually be a downloadable PDF) and then have other links after.
It would be nice to know though how to properly deal with such situations like separating columns by a boolean flag (or any other sort of query scope) in a model that is accessed via a relationship within a controller (or view.)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community