V
V
vlad9372020-07-19 00:05:11
Laravel
vlad937, 2020-07-19 00:05:11

How to organize such a hierarchy in Laravel?

There are the following tables:
-refcodes (id)
-promos (id)
-refcodes_promos (refcode_id, promo_id)

The third one is intermediate, linked via

belongsToMany »

And finally display the following hierarchy:

Refcode 1
- promo 1
- promo2
- promo3
Refcode 2
- promo 2 - promo
4 - promo
5

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
snowmage, 2020-07-20
@snowmage

If a promo can have a sub-promo, then enter a parent_id field in the promos table showing the promo's parent.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question