Using Laravel Factory States to Add More Configuration After Creation
I love using Laravel Database Factories for setting up test data. But, what about when we want to do more complex domain object creation besides just data values or relationships created outside of the factory? Let’s try using the afterCreated()
hook and states.