Launching Restaurants APIs
Explore how to build and secure API endpoints for managing restaurants using Laravel. Learn to create migrations and Eloquent models with soft deletes, enforce data validation, and protect routes with Sanctum authentication. By the end of this lesson, you will understand how to set up the foundation for fast and secure restaurant APIs.
We'll cover the following...
We'll cover the following...
Migration and Eloquent model
Each new module starts with a database table. Here as well, we will first create the restaurants table first. Let’s go through the migration file first:
The columns are self-explanatory. We have only kept a few columns compulsory. We are also going to use the ‘Soft Delete’ feature to archive the records instead of deleting ...