---
title: "Discussion on \"The Hidden Race Condition Inside firstOrCreate()\" | Hashnode"
description: "Discussion on \"The Hidden Race Condition Inside firstOrCreate()\". Laravel's firstOrCreate() looks atomic but isn't. Here's how it silently creates duplicate rows, and the fix that actually works."
url: "https://hashnode.com/posts/the-hidden-race-condition-inside-firstorcreate/6aa4e5ba20c9b9ad869dca63"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [The Hidden Race Condition Inside firstOrCreate()](https://eliasalrgeaidev.hashnode.dev/the-hidden-race-condition-inside-firstorcreate?utm_source=hashnode&utm_medium=feed)

Laravel's firstOrCreate() looks atomic but isn't. Here's how it silently creates duplicate rows, and the fix that actually works.

Sep 12 · 3 min read · eliasalrgeaidev.hashnode.dev  
Read the article

-   [#laravel](https://hashnode.com/tag/laravel)
-   [#php](https://hashnode.com/tag/php)
-   [#backend](https://hashnode.com/tag/backend)
-   [#sql](https://hashnode.com/tag/sql)
-   [#database](https://hashnode.com/tag/database)
-   [#databases](https://hashnode.com/tag/databases)

## Written by

[Elias Alrgeai](https://hashnode.com/@EliasAlrgeaiDev)

@EliasAlrgeaiDev

  
[View profile](https://hashnode.com/@EliasAlrgeaiDev)

Laravel & PHP Specialist

Laravel &amp; PHP Specialist. Building secure, production-grade backend systems engineered for the real world. Focused on raw performance architecture and database scaling.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
