Is there a way in Laravel to bulk-insert multiple records and get Eloquent models returned? #57525
Unanswered
LemanAmrahova
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
The mass insert will not return the pks so that you can retrieve them by pk afterwards. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I have a scenario where I need to insert multiple records at once.
I want to achieve all three:
One approach I thought of:
This works, but feels hardcoded, and I wonder if there’s a better or built-in Laravel way in Eloquent to do this. Or can be added in the future...
Beta Was this translation helpful? Give feedback.
All reactions