title: storing/displaying stats of a character
body: <p>I'm using Laravel 5 and I have characters who have equipements that bring them caracteristics.
  My entities look like : </p>
  
  <pre><code>character --&gt; character_equipement &lt;-- equipement  --&gt; stats_equipement &lt;-- stats
  </code></pre>
  
  <p>I don't know how to display the stats of the character because they depends on the equipment he is geared with.</p>
  
  <p>I fistly wanted to manage it with jQuery : when I load the page (something like 'myUrl/character/78'), I do an ajax query to extract this way : </p>
  
  <p>FOR this character I want all stats from all equipment he is geared with.</p>
  
  <p>Then I display them into my divs.</p>
  
  <ul>
  <li>it sounds maybe stupid to do an ajax query at the loading of the page (I'm a beginner so probably a dumb question)</li>
  <li>I'll probably have trouble to display my div correctly because I'll have to check the value to know if this kind of stat goes into this div for every single stat I took</li>
  </ul>
  
  <p>Secondly, I wanted to manage it through a model : 
  I take a response where I sum all the identic stats through my query then I display them into my divs.</p>
  
  <p>But this way, I'll probably have to go through my response every single div (I have at least 15 div) and I don't think that it's good for server performances.</p>
  
  <p>Lastly, I intended to store all attributes in my character entity :</p>
  
  <pre><code>id_char, name_char, img_char, health_char, strength_char, wisdom_char, damage_char 
  </code></pre>
  
  <p>etc...</p>
  
  <p>Could someone help me to take the best approach? Or maybe give me another one!</p>
  
  <p><strong>EDIT using eager loading :</strong></p>
  
  <p>Here are what I tried. I firstly wanted to take only equipements from my character to debug it. This is what I did :</p>
  
  <p>in my Character Model : </p>
  
  <pre><code> public function equipements(){
      return $this-&gt;belongsToMany(EncyclopedieModel::class, 'stuff_equipement', 'id_equipement', 'id_equipement');
  }
  </code></pre>
  
  <p>Then when I debugged it I have this response : </p>
  
  <pre><code> select * from equipement inner join stuff_equipement on equipement.id_equipement = stuff_equipement.id_equipement
  </code></pre>
  
  <p>Which is fine... Then I debug the initial query which looks like this in my controller : </p>
  
  <pre><code> public function getEquipementsChar(){
      return StuffModel::with('equipements')-&gt;where('id_stuff', 1)-&gt;get();
  }
  </code></pre>
  
  <p>And then I debugged it and it returned : </p>
  
  <pre><code>"select * from `stuff` where `id_stuff` = ?"
  </code></pre>
  
  <p>I thought that this function will search the character 1 with equipements but I don't know why my function is not going through the 'with', it seems that my function is ignoring it.</p>
  
  <p>Did I miss something?</p>
  
  <p>EDIT 2 :</p>
  
  <p>It had something with parameters I specified through my equipements() function. I modified them the good way and I'm now fine.</p>