Closed minthemiddle closed 4 years ago
Hullo!
I haven't tried to replicate this yet but is the issue to do with the first()
call?
StrikeFactory::new()
->forRound($round_inactive)
->create()
->first(); // This bit here
You're only creating a single Strike
model, but then call first as though it were a collection. I could be missing something, let me know if so.
Also, any chance you could post your migrations for the relevant database tables so that I can replicate them?
Yes, the first()
seems to be the problem. Had them as leftover from the old manual factory classes. Cut them and it seems to work. Let me confirm before you try to replicate.
Can confirm that the ->first()
was the culprit. Removed it and it works repeatly without hickups.
I believe there is an error with Poser when I use a factory with
belongsTo
relationships twice in a test:With
Strike.php
model contains:It also fails when I create the active round in place: