This seems like it should be a fairly simply question, but with Laravels (5.1) model factories, am I supposed to place every model definition inside the one ModelFactory.php
file?
If, for example, I have 200 different models, I can see this file (Database\Factories\ModelFactory.php
) getting very large and cluttered.
My question is:
Is there a better way to organise model factories, or should I really define them all in that one file? What is best practice?
If you have a look at the source code you can see that it takes the path (/factories) and requires every single file. So you can definitely create as many files as you want in that directory and separate them by concern or model.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With