Answer the question
In order to leave comments, you need to log in
Laravel 4. Subcategories. What do you think is better?
I am writing a project on Laravel 4 (my first project on this framework). There is multilanguage and subcategories (depth up to 4 nesting categories). I think to implement by specifying the ID of the parent category of each category.
(category "bulka" id 2 parent id 1 "toster").
There is also the option of assigning a "tag" category (taxonomy).
How do you advise to implement this as laravel-way as possible, what alternative and better options do you suggest?
Answer the question
In order to leave comments, you need to log in
For categories, such things are
suitable Matherialized Path Convenient that each element knows the return path (1.4.6)
Nested Set is convenient in selecting a complete tree of entities, not convenient when the tree changes frequently.
In general, I recommend using Nested Set for categories,
and using Matherialized Path for records.
Then it will be very easy to make such selections
Select all records from category + category 1 > +
can be implemented (hasMany|hasOne)
Here is a detailed description of how to do it:
laravel.ru/articles/odd_bod/eloquent-tutorial
I hope it helps =)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question