Defining an ERD

Database diagrams have been used for decades to show the tables, columns, and relationships in a database.

An Entity Relationship Diagram (ERD) is similar to a Database Diagram but an ERD is specific to an Object Relational Mapper (ORM). In Object Relational Mapping we use different terminology because we're mapping objects and not tables and columns. So, in ERDs we use the term Entity (Eloquent uses the term Model), to describe a mapped table and we use Field to describe a mapped column. The Entities have relationships between them such as a Performance to an Artist. ORMs each have custom properties for their entities and this data is part of the ERD too. And it is all this data we are storing in our Entity Relationship Diagram.

The ERD tool we'll use is Skipper. Skipper is a PHP-specific application with direct support for Eloquent. If you choose to continue on in these courses you will need to install a copy of Skipper.

Skipper is more than just a diagramming tool. From the ERD you create in Skipper you can export directly to your Laravel application's Models and generate your Migrations. Skipper creates two files for each model; an abstract and a concrete class. The abstract contains relational information such as toOne and toMany functions, the specific table name for the model, a complete mapping of field casts, and the primary key data type. The concrete model is not overwritten by Skipper and is used for Model-specific data such as sorting or filtering fields.