I tried to retrieve the record from three table category,sub-category and products. How to retrive records bellow format Like with using model relationship:-
1,sample-category1
1,sample-sub-category1
1,sample-product1
2,sample-product2
2,sample-sub-category2
3,sample-product3
2,sample-category2
3,sample-category3
Like while retrive the category then sub-category and product also need to fetch...
hi. this structure is wrong. because if you got a three layers of category you have to add another table. for that your table category table structure must be like this:
id parent_id title
which parent_id is a foreign key refers to the categories table itself. and of course parent_id is nullable.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community