Q:

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?

A:

I think it's the best you can do. I don't ever recommend to load unusable data to the user and then trace it to see what to show and what to hide it resources consuming and making all categories data available in the request -maybe in html too- even for non-authorized users. 
So the best I've used and seen in packages was your current approach. I know this may be not what're expecting to see as an answer but nothing as perfect as we want it to be.

