Laravel Eloquent ist an object-relational-mapper, an ORM, that makes working with databases a joy. While you still need a basic understanding about your database and how writing queries works, Laravel Eloquent provides convenient methos to insert, update and query this data. Eloquent uses the active record pattern where every column in the database table is accessible via a magic method of the related Eloquent Model.

The Eloquent relationships on the User model for this setup looks as simple as that: public function posts(): HasMany { return $this->hasMany(Post::class); } public function comments(): HasMany { return $this->hasMany(Comment::class); }

When you query your database with Laravel Eloquent, you can add as many where conditions to the query as you want.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners