Open manuphatak opened 9 years ago
What about using a closure instead? Would that not solve the issue or am I thinking in the wrong track?
I can't see why that'd make a difference though, since the create method runs a for loop over times
Hi @bionikspoon,
Your workaround was very helpful. Thanks for this
Pete
$faker->optional()
is only getting called ONE time per Seeder. So the results are either ALL filled or ALL empty instead of healthy mix of each.Problem
Isolated example:
and
You would expect about 50/100 entries to have
null
"comments", instead it's randomly either 0 or 100.Solution:
Using for loop instead of
times()
did not work.Using a for loop, pulling in
Faker
, overriding the factory did.Work around:
With this solution, the results are no longer ALL or NOTHING, it looks 50/50.