Posts List

The Benefits of Minimal Factories in Laravel

Laravel factories are a huge time-saver when writing tests. In the past, I’d build a factory to include every model property in the default state, but lately I’ve switched to having minimal factories by default. I’ll explain my reasons for this change, and what benefits I’ve found.

Laravel 8 Factory Relationships

A couple days ago, I walked through a few potential gotchas with relationships in Laravel factories. Let’s see how it works in Laravel 8.

Understanding Relationships in Laravel Factories

What’s the best way to define a relationship in your Laravel factories? I’ll share some tips that will help you avoid some common pitfalls, as well as give you a deeper insight into how factories work.