firstOrCreate prioritizes first parameters over second parameters #38303
-
Description:firstOrCreate is prioritizing the FIND parameters over the CREATE parameters, and this seems backwards to me. For example: I double checked the code and it looks like it's because of how PHP merges 2 arrays, due to this line: So if you want to know the actual real world example, of how the Create parameter would be different than the find parameter, take using an object with uuids:
I feel like it should logically play out like this: I hope that helps give context and makes sense. Please tell me if there is something obvious I missed because I am basically a Laravel newbie :) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
@driesvints are you saying this is expected behaviour rather than a bug? (as the initial issue was converted to a discussion) Seems more like a bug to me 😕 |
Beta Was this translation helpful? Give feedback.
-
Same "bug" exists with
Output
Expected?
|
Beta Was this translation helpful? Give feedback.
Now released https://github.com/laravel/framework/releases/tag/v8.55.0 👍