logo

Using factories with more than one relationship

Sometimes you can't follow the typical naming convention

Joel Clermont
Joel Clermont
2026-01-09

Laravel's factory for() helper is great for setting up relationships. But when two relationships point to the same model, conventions alone won't cut it.

In this video, I show how we can still use the nice fluent factory syntax to set up our test data.

Watch Now (4 min)

And after watching, don't forget to subscribe to our YouTube channel, so you don't miss future videos.

Here to help,

Joel

P.S. Want to level up your Laravel testing skills? Check out our testing workshop.

Toss a coin in the jar if you found this helpful.
Want a tip like this in your inbox every weekday? Sign up below 👇🏼
email
No spam. Only real-world advice.