Glossary

Eloquent

Eloquent is Laravel’s ORM — Object-Relational Mapper. It provides a clean, expressive API for interacting with relational databases using PHP classes and objects rather than raw SQL. Each database table has a corresponding Eloquent model, and operations like querying, inserting, updating, and deleting records are handled through readable method chains rather than hand-written queries.

In a standard Laravel application, Eloquent handles most database interaction. In Statamic, the default storage layer is flat files rather than a database, so Eloquent isn’t involved in the content layer by default. But when you need database-backed storage, Statamic provides Eloquent drivers that replace its default repository implementations.

When Eloquent Comes Into Play in Statamic

Statamic supports swapping its flat-file storage for Eloquent-backed storage on a per-resource basis. You might store entries in flat files but users in a database, for example, if you have a large user base that needs the query performance benefits of a relational database. Or you might switch everything to database storage if your content volume makes flat-file performance a concern, or if you need multiple developers editing content simultaneously without file-system conflicts.

The Eloquent driver approach means you’re not choosing between "flat files forever" and "database always." You can mix and match based on what each part of your site actually needs. See What’s the difference between Statamic’s flat-file and database modes? for a fuller comparison.

Comparison to WordPress’s Database Layer

WordPress stores everything — posts, users, settings, meta — in MySQL using its own database abstraction layer (wpdb). The schema is fixed: you can’t add columns to wp_posts, so custom data goes through wp_postmeta’s key-value structure. This works, but it creates some inefficiencies at scale and limits how you can query your content.

Eloquent, by contrast, operates against a schema you control. If you build a custom data structure for a Statamic site in database mode, you can design that schema for your specific use case — with proper relational tables, indexes, and types — and query it efficiently with Eloquent. This is one area where Statamic’s Laravel foundation provides genuine flexibility that WordPress’s architecture doesn’t offer in the same way.

For most content-focused sites, the flat-file default is sufficient and Eloquent is a background detail. But for high-traffic applications or complex data requirements, knowing it’s there as an option is useful.

Need more clarity?

Book a discovery call and we’ll walk through your situation — what you have, what the migration looks like, and whether it’s the right move.

Book a Discovery Call →