Eloquent ORM: Working with Data as Objects
Learn how to use Eloquent ORM to insert, read, update, and delete records easily.
Laura Mitchell
November 11, 2025
4.2k146
Eloquent lets you treat database rows as PHP objects.
Create a model
php artisan make:model Post
Insert data
Post::create([
'title' => 'My First Post',
'body' => 'Hello Laravel!'
]);
Fetch data
$posts = Post::all();
$post = Post::find(1);
Update and delete
$post->title = 'Updated';
$post->save();
Post::destroy(1);
How Eloquent works
flowchart LR
A[Controller] --> B[Eloquent Model]
B --> C[(Database)]
C --> B
In the next tutorial, we will map URLs to logic using routes and controllers.
#Laravel#Eloquent#Database#Beginner