← All Courses
Intermediate
Eloquent Relationships & Query Mastery
Go beyond basic CRUD — model real relationships, eliminate N+1 queries, and write Eloquent code that stays fast as your data grows.
This course picks up where Laravel Fundamentals leaves off. You'll model one-to-many and many-to-many relationships, learn why eager loading matters and how to spot an N+1 problem before it ships, build reusable query scopes, and shape your data with accessors, mutators, and casts.
You should be comfortable with basic Eloquent (creating, reading, updating models) and have completed Laravel Fundamentals or equivalent experience. A local Laravel app with a database is all you need to follow along.
Lessons
Defining hasMany and belongsTo Relationships
code
Preview
View →
Many-to-Many Relationships with belongsToMany
code
Eager Loading and the N+1 Problem
code
Query Scopes for Reusable Filters
code
Accessors, Mutators, and Casts
code