Courses

Eloquent: The Expert Level (Laravel 9)

FirstOrCreate, and Other 2-in-1 Methods

Previous: Model $casts: Dates, Enum and More
avatar

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

avatar
You can use Markdown
avatar

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.

avatar
You can use Markdown
avatar
You can use Markdown