Koskamo

Eloquent models

Document v1 · published by Koskamo editorial · updated 2026-10-04

Original source

Laravel includes Eloquent, an object-relational mapper (ORM) where each database table has a corresponding Model class used to interact with that table. Configure a database connection in config/database.php before getting started. Models typically live in the app\Models directory and extend Illuminate\Database\Eloquent\Model; generate them with php artisan make:model, optionally creating related files via options like --migration or --factory. Besides retrieving records, models can insert, update, and delete; the upsert method updates or creates records in a single atomic operation. Eloquent supports UUID and ULID primary keys and automatically manages timestamps. Chunking, lazy collections, and cursors process large result sets efficiently; global and local scopes reuse query constraints. Soft deletes, pruning, replication, events, observers, and strictness options are also available. Scope: Laravel. Reviewed October 4, 2026.

Source and provenance

Original source
laravel.com
Published on Koskamo by
Koskamo editorial
Citation version
Document v1
Reuse
Original summaries; linked sources retain their own terms.

The original source supplies the underlying information. Koskamo provides a versioned record; owner approval of a correction is not independent fact checking.