Laying the Foundation

Learn how to manage the static data in your Laravel applications.


With the authentication part done, we are ready to move to the heart of the course: restaurant management. Restaurants will have complete addresses, and we will store the country and the state for each restaurant. In this lesson, we are preparing for the ‘Restaurant’ module.

For the ‘Country’ module, we will do the following:

  1. Migration + Eloquent model
  2. Seeder + CSV file with data
  3. The API call to fetch countries
  4. A test for the API call

Do it yourself stuff

The migration, the Eloquent model, and the API call are fairly easy to do. It will help if you try them yourself. Here are some notes:

  • We will have just 2 columns: id and name
  • The Eloquent model class does not need any methods or properties as we are not offering the CRUD functionality here.
  • The API call directly fetches and returns the countries as an array.

Please try it yourself in the next widget. If you get stuck, the following button will help.

Get hands-on with 1200+ tech skills courses.