Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

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? (29 h 14 min)

You also get:

54 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.