Relations with Tailor

I have a catalog with relation to members and members have relation to categories.

1) Catalog item in "Catalog\Item"
2) Catalog categories in "Catalog\Category"
3) Catalog members in "Catalog\Member"

Catalog has multiple items and items has multiple members organised in categories. If it would be a blog, I actually want to categorize authors, not posts and categorisation of authors changes per post while authors names stays the same.

Example of theatre, where actors work in multiple acts and I would like to show them categorized in webpage per act.

Members: A, B, C
Act 1: Member A (category X), Member B (category X), Member C (category Y)
Act 1: Member B (Category X), Member A (category Y), Member C (category Z)

On front:

Act 1
Category X

  • Member A
  • Member B

Category Y

  • Member C

Act 2

Is this possible with Tailor? I have been able to do the linking of members correctly in the backend. But how can I loop members of those categories and all the categories including members in the front with twig?

Code example can be seen here: OctoberCMS Catalog - Pastebin.com

If I understood correctly, you can access them via twig and loop through them just by using the field names.

Kind of like {% for members in category_x.members %}

I hope this helps. Let me know if I got it wrong.

Thanks for the answer. There seems to be some something wrong as it does not print out anything. I’m not sure, does it have relation between item, member and category. Should I have some inverse logic from item and category, between member and category or even both?

Yes you’re right. You should have some inverse logic. You can use the wheteRelation method there as well.

We’ve since added inverse support to Tailor fields. Does this help?