Complicated relationship setup
I will try to explain the DB relations since this is rather complicated. And to save typing each relationship has an inverse
User has Many Profiles (working no issues) Profile hasMany Subscription (working no issues) Subscription belongsToMany Area (working no issues)
Now each Area i am adding a new hasMany relationship to Regions(think Los Angeles, has many Regions)
So when a user selects an "Area" the form has options to select "regions" of that area. So what is this relationship of region <-> area <-> profile <-> subscription
Profiles are filtered "active" based on subscription date, so if expired they are not included in the site.com/los-angeles page.
But the point of the new "regions" is that on Los Angeles "Area" there is a filter to allow to select the "regions" of Los Angeles ( Hollywood, Long Beach...) to refine the listings.
So aside from the relationship also come the maintenance problem because I am thinking a pivot table with area_id, subscription_id, region_id, profile_id, but if a profile was in Los Angeles and selects 5 regions we have 5 records in DB, then they select Chicago it creates new records doing nothing to the now dead records for Los Angeles, deal with that later i suppose.
Just what would be the best / proper setup of relations for this new profile <-> subscription <-> area <-> regions table
Please or to participate in this conversation.