Hi,
I'm currently designing our database structure, and I'm currently struggling wether to define 1-to-many or Many-to-many.
So, here's a sample scenario:
Let's say I have the following entities:
- Hero
- City
At first glance, we know that a Hero may save many Cities, and a City can be saved by many Heroes. So we can already say there's a M:M relationship there.
But is it acceptable if I treat this M:M table into a single entity?
Here's the table definitions for each relationship:
- If I treat this table as it is, a
Many-to-Many pivot table: city_hero
city_id
hero_id
- If I treat it as a standalone entitiy:
saves
city_id
hero_id
saved_on
casualties
As you can see, either way, city_id and hero_id are still being referenced.
I know I can extend my model with the Illuminate\Database\Eloquent\Relations\Pivot class, and I also know that there's nothing holding me back on treating this as a standalone entity, but what would be the downside/effects if I treat it as one instead of a pivot entity?