In this episode, we're finally making use of all the referral data we've been collecting. We'll update our dashboard so users can see useful stats about their referral code: how many people have clicked it, how many visits, and how many actual conversions (aka subscriptions) have come through.
We'll walk through building a partial for the referral stats, setting up a nicely styled stats table that shows those counts. Then, we take it a step further and create another partial to display all the active referrals. These are the subscriptions that are still active and earning the user payouts, and we'll show more details about each one—like when they signed up, what plan they’re on, and the percentage commission they're earning (along with the actual dollar amount!).
Along the way, we'll make a couple of technical tweaks. For example, we’ll extend the Stripe Cashier subscription model so that we can make an Eloquent relationship between a subscription and a plan in our own database (using the Stripe price ID as the connector). This lets us display the plan name and value right in the stats table. We'll also dig into how to grab the commission percentage from the pivot relation, and use our Money object to multiply out the actual value of each referral payout.
By the end, we’ve got a pretty thorough dashboard for users to see how their referrals are performing—and we're all set up for upcoming features, like handling future referral payouts.