Playing
05. Deleting an address

Episodes

0%
Your progress
  • Total: 4h 18m
  • Played: 0m
  • Remaining: 4h 18m
Join or sign in to track your progress

Transcript

00:00
OK, so you can probably already figure out how you're going to delete an address.
00:04
But let's go ahead and cover this anyway. So once again, let's create out a route here just so we can play around with this. And we'll just create this as forward slash delete. And inside of here, we'll do exactly the same thing.
00:16
Go ahead and grab the user whose address we want to delete. And then we'll go ahead and access the address relationship. And you probably guessed it. We are going to just say delete.
00:28
We don't need to pass any data down to here because that, of course, is just going to remove that from the database. So over on our homepage, we currently have an address which has been previously updated.
00:40
And of course, this exists in the database. But as we head over to the delete endpoint here that we've created, that is going to go ahead and just remove that from the database table. There's no recovering this.
00:53
It will just be completely deleted. And of course, when we head over to the homepage, there is no address. So we don't see that data anymore. So very easy to go ahead and delete a record just using the delete method.
33 episodes4 hrs 18 mins

Overview

Eloquent is Laravel's ORM (Object Relational Mapper). In simple terms, it's how your models work with the database.

The good news? There's a bunch of powerful relationship types available. Our task is to learn when and where to use each one.

In this course, we'll cover each basic relationship type, how to access related models, and then insert, sync, update and delete related data. Oh, and we'll build a practical example for each relationship type, to really make it stick.

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

Comments

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