Eloquent ORM relationship
Eloquent is the ORM that is behind Laravel's database queries. It's an abstraction of active record implementation.
As we saw previously, each application model has a respective table in our database. With this, we can query, insert, delete, and update records.
The Eloquent ORM uses the snake case plural name of the class, which will be used as the table name, unless another name is explicitly specified. For example, our Bike
model class has its own table bikes.
The application models have the following tables:
Application Model | Database Table |
---|---|
| bikes |
| builders |
| garages |
| items |
| ratings |
| builders |
| users |
Note that we keep the table convention name, but it is possible to use a custom table name. For the scope of this book, we will keep the table names generated by Laravel.
Note
You can read more about table names and model conventions in the official Laravel documentation at https://laravel.com/docs/5.6/eloquent#defining...