Hey, I'm writing a book.  Eloquent Beyond The Basics

🔥 Laravel Tip: Default Models

Apr 22, 2022

In your relationships, you can define default models.

That way if the relationship doesn't exist it will return a default model so you don't have to check if is null every time.
tip-image-0