From the course: Building RESTful APIs in Laravel

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

The project infrastructure

The project infrastructure

From the course: Building RESTful APIs in Laravel

Start my 1-month free trial

The project infrastructure

- [Instructor] To get started building our RESTful API, let's create everything we will need during this course. We will need a model, a migration, a controller, an API resource, a factory, and a seeder. The most important part of our e-petitions application is the petition model. Each database table has a corresponding model which is used to query the data or add new data to the table. We can use php artisans to create our model by running php artisan: make model Petition in the terminal. The convention is to use the singular case. So petition, not petitions. Before we ran the command, we could also create other classes we will need. By adding the -mo-- migration flag, php artisan will also create the migration. By adding the -f or --factory flag, it will create a factory. The -s or --seed flag will create a seeder, and the -c or --controller flag will create a controller. Or we could just run -a or --all flag to…

Contents