-
Notifications
You must be signed in to change notification settings - Fork 176
Description
Hello,
with laravel/framework 5.3.17, they have added states to model factories. It would be nice to have this adopted in orm, since it is similar to defineAs functionality. States would be just more familiar to Laravel users and they have one advantage compared to defineAs - you can stack them up.
States are described here: https://laravel.com/docs/5.3/database-testing#writing-factories
The main difference from yours defineAs is, that with states, you define only those properties, which are different from those in base factory and you can define multiple states. Then, when you are calling factory()->states(['one','two'])
it would merge all state properties on top of base factory properties.
I think, that this is really neat, since you can combine those in many different ways. With defineAs, you don't have that much flexibility.
Thanks for considering this ;-)
Jakub
Related to quick-fix #198