Skip to main content

FirstOrCreate, and Other 2-in-1 Methods

Premium
4:02

The Full Lesson is Only for Premium Members

Want to access all of our courses? (30 h 33 min)

You also get:

55 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

AG
Alex Gower ✓ Link copied!

Upsert is cool. Thanks I have not tried it yet.

R
Ryan ✓ Link copied!

A useful feature of firstOrCreate and updateOrCreate which I use a lot is that you can pass two arrays to these methods. First array could just be a unique field to find an existing record and second array could be the remaining fields.

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.