title: Modeling database with many (0,n) relations
body: <p>I have a database to manage characters and I would like to add some changes: </p>
  
  <p>Now :</p>
  
  <p>One characater has multiple equipements, one equipement belongs to multiple characters.</p>
  
  <p>One equipement has multiple stats, one stat belongs to multiple equipements.
  <a href="https://i.stack.imgur.com/zDw43.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zDw43.png" alt="enter image description here"></a></p>
  
  <p>We can know the side of an equipement for a character if we know the caracter and the equipement so I put "side" on the pivot. The problem is : the side only concerns rings so my data for side looks like </p>
  
  <pre><code>null | null | null | left | null | right | null |null | null | null
  </code></pre>
  
  <p><strong>Is it a problem to have an attribute only concerning one type?</strong></p>
  
  <p>Also, I want to add for a stat, elements. The problem is that for something like 30 stats, only 2 are concerned by elements. And for a stat concerned by an element, the character choose one element or more elements. It will probably looks like this : </p>
  
  <p><a href="https://i.stack.imgur.com/eoMDy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eoMDy.png" alt="enter image description here"></a></p>
  
  <p>For the moment, I manage the stats like this : </p>
  
  <p>I retrieve all data for a character with his equipements, then when I know his equipements I can retrieve all stats (I know their value through "value_stat"). Thanks to Laravel, I do it with eager loads.</p>
  
  <p>Now to have the "value_stat" I must know id_character, id_equipement, id_stats, id_element because the element chosen depends on the character. Is that pattern correct? Even with that pattern for most of cases, id_element will be set as null because element is only for some stats.</p>
  
  <p>Thanks!</p>