You can define default model data for BelongsTo relationships

You can define default model data for BelongsTo relationships

🔥 Laravel Tip: Default Models.

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.

We're writing a book, you can get it for free here.