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

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

0

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) }}

0

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.)

0

Sign in to participate in this thread!

Eventy

Your banner here too?

mseymour mseymour Joined 25 Feb 2014

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.