title: Advice for referral tracking using MySql and Laravel
body: <p>I need some help figuring out the best way to tackle this. Here's the gist:
  I have a subscription site that has 3 levels Free, Pro, and Premier. I have referrals set up so if someone signs up I create a record with the referred id and the referral id and if they upgrade to a paid subscription I add the sub id and level.</p>
  <p>But here's the situation, trying to create a tracking table so the people who refer others can look and see how many free, pro, and premier they have for a specified time period.</p>
  <p>I'm stuck on how to track this as far as in a MySql table. I would need to know how many free, pro and premier each referral has each month and every time that referred id pays for another month, so recurring. And if they upgrade or downgrade their level that needs to be reflected as well.</p>
  <p>I was thinking every time that user is charged then I would add a new referral row with basically the same referred id and referral id and add the subscription level. That way I can count up how many pro/premier levels that person had for the month. But then what happens if that person upgrades or downgrades? Do I just update the latest referral row I created with the new level?</p>
  <p>Am I on the right track here? Any advice on how to handle this would be much appreciated!</p>
  <p>Thank you in advance!</p>