Answer the question
In order to leave comments, you need to log in
Yii2 and Nested Sets - Users have their own categories - how best to implement?
Good day. There was such a problem, there is a project in which each user can create their own categories, which are available to each user individually, at the same time there are general categories (preinstalled by the system) and are available to everyone. I plan to do the project on Yii2, and I decided to use yii2-nested-set-behavior from creocoder to work with categories. Before that, I didn’t deal with these things (trees) and so far it’s going very hard.
For example, there is the following structure:
- system
- Soup
- Garnish
- Meat
- User 1
- Fish
--- Steamed
--- In oil
--- Fried
-- Liver
- User 2
-- First course
-- Second course
etc.
There can be any number of nesting levels.
In fact, root categories are user binding, and the second level is the root categories of a particular user.
The question is how best to implement? I have an idea to make root categories by username (or id, not the point) in which users will add their own categories, and one common root. But it seems to me that the root categories as I conceived are a big crutch, which is why this question appeared here.
And what options did you use or maybe you just know how to do it better with minimal effort?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question