Playing
01. Introduction and demo

Transcript

00:00
In this course we're going to be building out a friend system in Laravel completely from scratch. So I'm over on the friends page just here and the first thing that you'll notice is I already have a couple of friends. We're going to
00:12
go ahead and remove them and re-add them so we can look at the process. But first of all I'm going to head over to the dashboard and we're going to look at this list of statuses. Now as well as building up the friend system what we're also going to do is look at some more advanced things like getting models
00:29
through your friends. So if we just head over to the database really quickly we can see that we've got a list of statuses. So this could be like a list of posts that a user has written and of course we're going to want to see all of our friends statuses. So if we just come over to this one here this is my account
00:46
Alex. I'm friends with Mabel and Mabel has posted just one thing. If I come over to Mabel's account though she is friends with Alex and she can see both of Alex's posts here and if Mabel had other friends and they had posted we would also see them here as well. So now that we've got that out and done with let's
01:05
go over to the friends table and just delete both of these friends records in here and we're going to come straight back over to my account here. Of course we don't see anything on the dashboard because that friend has been deleted and if we come over to the friends page of course we don't have any friends any
01:21
requests or any pending friend requests either. So as part of this we're going to be building up three different relationships. The friends relationship of course that's going to just give us all of our friends. The friend requests that we have received but also any pending friend requests that are going out as
01:38
well. So let's just go over to a profile page. We'll have to check over in the database really quickly some of these users. So let's say user ID of 14. So we're going to head over to slash profile slash 14 which is just a really simple page I've built out where we can add a friend and see the status of this.
01:56
If we hit add a friend here you can see we're now in this waiting for Mabel to accept your friend request. We can also cancel that request and re-add it in if we want to. But now if we head over to Mabel's account and go over to the friend section you can see that we've got a list of friend requests here. While
02:14
we're here let's go over to profile and 15 I think it will be for Fred and add him as a friend. If we come over to the friend section where you can see we've now got pending friend requests. So of course incoming friend requests we're going to be able to accept these or reject them and pending friend requests
02:31
we can cancel much like we saw over on the profile page. So I'm just going to cancel this request off here and I'm going to go ahead and accept Alex's request and of course you can see that's now moved over to the friends list. If we go over to Alex's profile you can see that this status changes as well and of
02:47
course this looks very simple but when you integrate this into your own application it's of course going to look a little bit better. So that is pretty much it. We can of course unfriend someone if we want to in which case that goes. That shouldn't say friend requests we can change that during the course but
03:03
that's pretty much it. A lot of work is going to go into this because we need to make sure this works really really nicely from each user as they add friends accept them. There's a couple of conditions around adding friends and updating things as well which we will cover in a lot of detail. And we're going
03:22
to set this up in such a way that it's going to be super easy to integrate into your own application if you've already built one. Okay now we've looked at the demo and what we can do with this let's head over get a fresh Laravel project set up and get coding this out from scratch

Episode summary

Welcome to the course! In this introductory episode, we're kicking things off by taking a look at what we'll be building—a complete friend system in Laravel, all from scratch.

We start with a quick tour of the app, showing you how users can have friends, post statuses, and why we'll want to see our friends' statuses on our dashboard. We'll also explore how the friends page works, and how incoming, outgoing, and accepted friend requests will appear. You’ll see how the relationships update in real time as users add, accept, reject, or remove friends.

We demonstrate the process by removing and re-adding some friends, sending and canceling requests, and accepting or rejecting invitations. This gives a clear idea of the user experience we’ll be aiming for. The system will support the three main states: friends, received requests, and sent (pending) requests—and display things correctly from each user's perspective.

Throughout this course, we’ll not only build the basics, but also dig into more advanced scenarios, ensuring the process works smoothly and can be dropped into any Laravel app you have. At the end, we’re all set to jump in, set up a fresh Laravel project, and start writing code together!

Episode discussion

No comments, yet. Be the first!