Creating, Reading, Updating, and Deleting Records (CRUD)
Almost every feature in a web application eventually comes down to CRUD: creating, reading, updating, and deleting records. Eloquent makes each of these operations concise, replacing what would otherwise be several lines of raw SQL with simple, expressive method calls.
Creating Records
New records can be created by instantiating a model and calling save(), or more concisely using the create() method, which accepts an array of attributes in one step. Mass assignment through create() requires the relevant fields to be listed in the model's $fillable property, as a safeguard against unintended data changes.
Reading Records
Eloquent offers a range of methods for retrieving data, from fetching a single record by its primary key to building complex, filtered queries using the underlying query builder.
Updating and Deleting Records
| Operation | Common Method |
|---|---|
| Create | Model::create([...]) |
| Read (single) | Model::find($id) |
| Read (all) | Model::all() or Model::where(...)->get() |
| Update | $model->update([...]) |
| Delete | $model->delete() |
- Updating a fetched model instance and calling
save()persists any changed attributes - Deleting removes the underlying row, unless the model uses soft deletes
- Bulk updates and deletes can be performed directly on a query, without loading each record
These CRUD operations depend entirely on a table already existing with the right structure — which is exactly what migrations are responsible for creating and running.
Ready to master Laravel Training Course?
Join Uncodemy's hands-on Laravel program and build real, production-ready applications.
