32. Removing a pending friend request


OK. So before we continue, we're just going to fix up a quick issue with cancelling frame requests.
If I go ahead and enter a email in here to add, let's go ahead and do that now, and click this, I can't actually cancel this. We know that cancelling a frame request
is the same as removing a frame request, because it just deletes it from that pivot table. So what we need to do is just come over to our template here, so under Friends and Index,
and let's come down to the Pending Frame Request section and just fill out the form like we did for the others. So for this, it's pretty much just going to be the same as this form just here.
Let's go ahead and grab this form, pull this down here, and just put this in here. And then let's just go ahead and say Cancel, because it's a slightly different action.
And we're just going to go through to exactly the same place, post through to this with that delete method in here. So now if we just come over and we look at this one here, and we get, yeah, Undefined Variable Friends,
because that needs to be Pending Friend. So let's switch that to Pending Friend, that looks good. And if we come back over to here, there we go, we can cancel this.
Now, we didn't include the email there like we've been doing for the others. Let's add that in there as well, just for a little bit of consistency.
So let's come down and pop that in here, and of course, switch that to Pending Friend. And if we now come back over, there we go, we can click Cancel.
That removes it, of course, for us and also the other user. So of course, a quick UI update. We already know the functionality works because we've tested it, but just a quick update to the UI.
35 episodes4 hrs 19 mins


Pest is a PHP testing framework that brings beautifully simple syntax to your tests, without sacrificing on features. In this course, we'll get up and running with Pest in a Laravel project and write tests for a real-world application that we'll build along the way.

You'll learn how to set Pest up in a Laravel project, write tests with Pest's built-in assertions, generate code coverage, and more.

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


No comments, yet. Be the first to leave a comment.