Hey all - just looking for a tip on how to structure my DB. I’m building an app that allows people to build websites. This is the basic structure:
User -> Project -> Website -> Components
A user has many projects, which have many websites etc.
Where I’m struggling is how to associate the website or component with the user.
The reason being, I only want to allow people to create a website or component, if they own the project.
Obviously its easy to associate project with user, because it has a belongsto relationship. Do I have to create a relationship with user for every part underneath project in the hierachy too? Or is there a better way?
New to this, so all advice appreciated
One other idea I have is to import the Project model into everything below, and run a check through that model?