Im building a foosball game logging site, and need some advice on how to layout the database. What I need help with is how to build the relations with these conditions in mind:
- Each game has 2 teams
- Each team has 1 or more users/players
- Since
team = colors
, each team can have different players in each game. In "game 1" players 1 & 2 can be in "team 1", but in "game 2" the "team 1" can consist of players 3 & 4.
This is the DB layout so far:
Users/Players:
id
username
- ...
Teams/Colors:
id
name
- ...
Games:
id
team1_id
team2_id
team1_score
team2_score
- ...
Which additional table(s) do I need to add to make this work "the laravel way"?
Normally I would add a table with game_id
, user_id
and team_id
columns, but I guess there is a cleaner solution with laravel.