Is there a way to use factories.createMany with a db seed? #1297
Unanswered
codepotato
asked this question in
Help
Replies: 2 comments 3 replies
-
A little more debugging here has narrowed it down to my userFactory.
When I remove faker.name and replace it with a sting, it works. |
Beta Was this translation helpful? Give feedback.
3 replies
-
I don't understand. Why you are feeding the output of your factory to the model? Simply running UserFactory.createMany() will perform the inserts |
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
-
I'm very very new to Adonis but I'm coming from a 5 year background of Laravel so understand the concepts that are being used in Adonis nicely however I've fallen at the first hurdle; seeding db with factory created models!
To be clear, I've setup mysql and can confirm the connections are working as I have migrated (how damn easy was that!) but I think I'm having a derp moment when attempting to create factory powered models.
My code at the moment is:
Any ideas why, when I run db:seed, it's attempting to put an empty object as one of the model parameters?
Just to add, I'm using Adonis v5
Beta Was this translation helpful? Give feedback.
All reactions