factory()->count(4)->create() executes 4 SQL Queries. Is there a more efficient alternative? #49331
Unanswered
williwlwilliwll
asked this question in
General
Replies: 2 comments
-
Exhibits the same behaviour - 2 separate SQL insert queries |
Beta Was this translation helpful? Give feedback.
0 replies
-
$trainingResource = TrainingResource::factory(4)->raw();
TrainingResource::insert($trainingResource); If you want timestamps ( |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
I can see through using Telescope that the following code executes 4 separate SQL queries:
This is not as I would expect/want.
Is there a way that I can create 4 models through the Laravel framework which uses only 1 SQL query?
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions