O'Reilly logo

Mastering Laravel by Christopher John Pecoraro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Querying the Database with the Eloquent ORM

In the previous chapters, you learned how build the basic components of an application. In this chapter the Eloquent ORM, another one of the best features that makes Laravel so popular, will be introduced.

In this chapter, we'll cover the following topics:

  • Basic query statements
  • One-to-one, one-to-many, and many-to-many relations
  • Polymorphic relations
  • Eager loading

An ORM, or object relational mapping, explained in the simplest sense, turns a table into a class, its columns into attributes, and its rows into instances of that class. It creates an abstraction layer between the developer and the database and allows for easier programming, since it uses the familiar object-oriented paradigm.

We shall ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required