In this episode, we start building the user profile page, which is going to be really important for our app since this is where users will be able to add each other as friends. First, we set up a basic controller and route for the profile, using route model binding to fetch the user by ID (or username if you want to go that way for more security).
We then get the profile view up and running, passing the user from the controller so we can display their details. We quickly duplicate some user data so we have more than one profile to view and test. Next, we focus on getting the template sorted—showing the user's name at the top and getting rid of unrelated details like a "You're logged in" message.
To wrap things up, we scaffold out the UI for the "Add as friend" button with a form, using a POST method and including the CSRF token for security. The button doesn't actually work yet, but we've set up everything we need to come back and wire up the add friend functionality later. Also, there's a note that we shouldn't be able to add ourselves as friends, so we plan ahead to handle that scenario.
So, by the end of this episode, we have a basic profile page ready, along with a placeholder for the friend request feature!