This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

anexception
anexception

How to loop through two tables in database with Builders plugin "Record list" component ? Is there another way to achieve this without the component ?for example like the code below:

{% for rec1 in records1 %}

    {% for rec2 in records2 %}

        {% if rec1.id == rec2.number %}

               // do somthing

        {% endif %}

    {% endfor %}

{% endfor %}

Last updated

mjauvin
mjauvin

just fetch each set of records directly, like:


function onInit() 
{
   $this['records1'] = YourModel1::get();
   $this['records2'] = YourModel2::get();
}

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.