Tuesday, April 11, 2017

Laravel category - subcategory

I have made a Laravel application with category/subcategory layout. Both DB and models work fine with one table connected back to itself with parent_id in Category model/table.

I was wondering about the best approach for loading the items for each subcategory. The way it is done now is with jQuery which is filling the accordion class with the data by making a get request to Laravel route.

I was thinking if there is some better way to do it? Maybe loading complete subcategories data and dynamically assigning visibility or something more...Laravel type?



via Norgul

Advertisement