Secrets of the Eloquent

I was really surprised with some of the cool functionality that’s been unearthed with this recent Laravel Daily post. Some of these I’ve seen quite often and have been ones I’ve done myself!

One of my pet peeves for a long time has been what to do if the relationship is empty, turns out there’s an withDefault() method that can be added to the end of a relationship.

Tags: ,

Leave a Reply