This episode is for members only

Sign up to access "Build a Friend System in Laravel" right now.

Get started
Already a member? Sign in to continue
Playing
11. Unfriending friends

Transcript

00:00
Removing a friend is going to be pretty straightforward because we already have a controller to deal with this. So let's just go ahead and hook this up over on the friends index page. We're going to return back to the profile page as well a little bit later to look at the logic around this.
00:14
Okay, so to unfriend someone, it's just going to be the same as cancelling or rejecting a request. So we can pretty much just grab this entire form. Like I said earlier, you could create separate controllers out for these if you wanted specific things to happen when these actions had happened, but we're just going to share them for now.
00:33
Okay, let's go ahead and paste this form into here. Let's just make sure this goes through to friend destroy but actually calls the friend itself because we're now within the friends list and we want to go ahead and delete but we want to change this over to unfriend. It's pretty much all we need to do.
00:49
So if I want to go ahead and unfriend Tabby, I can do that. And of course from Mabel's side as well. She could unfriend me and that also deletes the relationship. So now no one has any friends.
14 episodes1 hr 16 mins

Overview

Everything you need to implement a friend system in Laravel, built in a simple UI so you can integrate it into your existing apps.

We'll start with the basic friend relationships, then add in more advanced relations to make things future-proof. Want to easily get all friend's statuses on a timeline? No problem.

Alex Garrett-Smith
Alex Garrett-Smith
Hey, I'm the founder of Codecourse!

Episode discussion

No comments, yet. Be the first!