Eloquent Relationships By Example

33 episodes4 hrs 18 mins

Course overview

Eloquent is Laravel's ORM (Object Relational Mapper). In simple terms, it's how your models work with the database.

The good news? There's a bunch of powerful relationship types available. Our task is to learn when and where to use each one.

In this course, we'll cover each basic relationship type, how to access related models, and then insert, sync, update and delete related data. Oh, and we'll build a practical example for each relationship type, to really make it stick.

Alex Garrett-Smith
Alex Garrett-Smith
Hey, I'm the founder of Codecourse!


Your progress
  • Total: 4h 18m
  • Played: 0m
  • Remaining: 4h 18m

Related courses

Making Eloquent models 'LiveAware'

If your models share a 'live' property that you control, why not refactor this down to a single unit of functionality?

11 mins
Quick and Easy Nested Categories in Laravel

To solve a potentially unlimited amount of nested items like categories, you need more than recursive Eloquent relationships. Let's figure out how to easily build a tree of items with a single query, and use recursive Blade components to output the result.

20 mins
Easily Register Laravel Observers with an Observable Trait

If you're using Eloquent model observers, you'll know registering them can break your flow. How about a convenient trait to automatically hook up the associated observer? Let's build it!

4 mins
Laravel Performance

Let's keep our Laravel applications feeling snappy! In this course, we cover the absolute fundamentals you need to keep in mind when building anything with Laravel. While Laravel handles a lot for you, it's easy to fall into the trap of not considering and monitoring performance as you go. Keep these tips in your toolbelt, and you'll be able to develop faster apps, from the beginning.

1 hr 9 mins