From Creation to Deletion: MySQL’s Complete Data Toolkit What are CRUD operations? Create, Read, Update, Delete. That’s what we have created over the last few articles. The last piece of the puzzle is to combine them into one file that knows how to manage our authors table. If you’re jumping straight into this article, I recommend that you read the earlier articles leading up to this one first. You don’t need to, but it’ll help. MySQL Introduction MySQL DB Connection MySQL Tables MySQL Insert MySQL Insert with Prepared Statements MySQL Insert Multiple Records with Prepared Statements MySQL Select MySQL Update (PUT vs
Tag: MySQL Delete
Erasing Data with Surgical Precision The last of the operations is the delete operation. Just like with our update functionality, there is no delete method. We can submit a hidden method with delete as the value. We can use post and specify a value, but we’re building up for Laravel. Laravel accepts various requests and can process them easily. Here’s a list from their documentation. https://laravel.com/docs/9.x/controllers#actions-handled-by-resource-controller As you can see, if we wanted to delete a photo, we need to provide the {photo} resource. In our case, we’ll need to provide the author’s id. Previous Code Review Make sure that you’re up to date on the previous code. Author.php DB.php UpdateAuthorEmail.php