In this episode, we're building out a referrals dashboard feature for our app! You'll see the process of creating a new controller to handle the referrals page, setting up the route, and building out a simple view for the dashboard itself.
We hook up the new referrals dashboard to appear in the main navigation, but there's a catch: users need to have a PayPal email address set up to actually see or access this page. So, we'll go through how to hide the menu link when a user hasn't entered their PayPal info, by wrapping the navigation link in a conditional statement.
To make things more secure, we also create some middleware that stops users from accessing the referrals route if they haven't yet filled out their PayPal email address. If a user tries to go to the referral page without meeting the requirement, they'll be redirected to their profile page so they can add their email.
By the end of the episode, your app will have a referrals dashboard that's only accessible to users who are ready to actually receive referral payouts!