title: Doing math on variables in blade, moving to controller
body: <p>To clarify, this row appears properly on the webpage and shows the proper percentage, so this works perfectly. I'm just not crazy about doing this math directly in the blade for the div itself.</p>
  
  <pre><code>&lt;div class="uk-float-right uk-margin-small-right"&gt;&lt;span class="uk-text-medium uk-text-center"&gt;{{ROUND((($snapshots[1]['COUNT'] - $snapshots[0]['COUNT']) / $snapshots[0]['COUNT'])*100,0)}}%&lt;/span&gt;&lt;/div&gt;
  
  I tried modifying it in the controller like so:
  
  //this is the pre-existing variable where my data comes from
  $snapshots = $callActivity-&gt;snapshot($this-&gt;slsno);
  
  //this line was added for the percentage change
  $percentChange = ($this-&gt;snapshots['CURRENT'] - $this-&gt;snapshots['PRIOR']) / $this-&gt;snapshots['PRIOR'];
  
  //$snapshots was pre-existing, but I'm adding percentChange to the blade here
  -&gt;with('snapshots', $snapshots)
  -&gt;with('percentChange', $percentChange);
  </code></pre>
  
  <p>When I dump $percentChange here I get a NAN value, but if I just do the hardcoded html above it works perfectly. I'd just like to try and do this in the controller to keep the blade clean. What's the best way to do that here?</p>