You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I've a question about Database and Lucid Model relationship.
Let's say, There is a categories table linked Category Model like following:
id
title
parent_id
1
Real Estate
null
2
Vehicle
null
3
Housing
1
4
Automobile
2
and there is a main_features table linked MainFeature Model like following:
id
title
category_id
1
Room Count
1
2
Bath Count
1
3
Brand
4
4
Model
4
I've written relationship code(hooks) that links MainFeature and Category Model to each other. So, if I wanna fetch a category, it comes with its preloaded MainFeature. There is no problem here but there is another problem there.
In this situation, If I want to fetch "Housing" category, it doesn't comes with ITS PARENT'S MAIN FEATURES.
So, I want CATEGORY to comes WITH ITS PARENTS' MAIN FEATURES.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, I've a question about Database and Lucid Model relationship.
Let's say, There is a categories table linked Category Model like following:
and there is a main_features table linked MainFeature Model like following:
I've written relationship code(hooks) that links MainFeature and Category Model to each other. So, if I wanna fetch a category, it comes with its preloaded MainFeature. There is no problem here but there is another problem there.
In this situation, If I want to fetch "Housing" category, it doesn't comes with ITS PARENT'S MAIN FEATURES.
So, I want CATEGORY to comes WITH ITS PARENTS' MAIN FEATURES.
How can I do this? Thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions