In this video, Keith Casey demonstrates how to include the ability to delete messages from our database via the API.
- [Instructor] Now our API is both read and write capable.…But how do we make it delete?…Luckily, with our approach,…it is easier than you might think.…Let's start off by copying the post route.…So we take this route, we'll just copy it down below.…Get rid of the middle portions.…Make sure to change this to a delete.…And then we need to do a couple more things.…One of those things is add a parameter.…Without this parameter, if we just the Delete Messages,…it implies that we're deleting everything.…Probably not what we want to do.…
So in this case, we'll delete a specific message.…We'll pass that id back into the route,…and then we'll do stuff with it.…Which turns out to be really simple.…Using Eloquent, you still use a message.…This time we say Message, Find, we use our message id.…So Eloquent behind the scenes…will look up that object for us…and retrieve it from the database automatically.…Then, we call Delete.…And that's really all it takes.…It's almost disappointing about how little code it is.…But let's clean this up a little bit…
This course begins with a simple application specification and builds it one step at a time. Each chapter includes a key concept, with examples from other public APIs, and then shows how to build it yourself with Silex. Learn about URL routing, validating input, and generating response codes and hypermedia payloads. Like any project, the first implementation may be a little messy, but don't worry. The last chapter covers refactoring and what it takes to scale and support the API going forward.
- Understanding the project goals
- Adding authentication with Silex
- Using cross-framework and authentication middleware
- Creating a read-write API in Silex
- Uploading files via an API
- Adding file security
- Creating payloads and response codes in Silex
- Scaling your API
Skill Level Beginner
PHP Date and Time Essential Trainingwith David Powers4h 31m Intermediate
PHP: Managing Persistent Sessionswith David Powers2h 41m Intermediate
1. Project Explanation and Goals
2. Authentication Options and Tradeoffs
Cross framework middleware1m 32s
3. Create a Read-Write API
4. File Uploads via API
5. Scale Your API
Next steps1m 46s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.