Querying Data with Eloquent ORM in Laravel — a practical guide to Laravel Eloquent ORM with clear examples you can reuse in real projects.
Laravel Tutorial Series (10/27). Prefer one page? Read the complete Laravel tutorial (all 27 topics).
Short description
Eloquent gives a fluent API for common SQL operations without writing raw queries for everyday CRUD.
Common queries
$all = Post::all();
$one = Post::find(1);
$post = Post::where('slug', 'hello-laravel')->first();
$published = Post::where('is_published', true)
->orderByDesc('published_at')
->limit(10)
->get();
Where + like search
$results = Post::where('title', 'like', '%laravel%')->get();
Aggregates
$count = Post::count();
$maxId = Post::max('id');
Eager loading (avoid N+1)
$posts = Post::with('user')->latest()->get();
Raw when needed
$posts = Post::whereRaw('YEAR(created_at) = ?', [2026])->get();