Skip to content
Discussion options

You must be logged in to vote

Hi there ✋🏻

Would be cool if Laravel added a factory method on relationship classes to set this up

Actually we have this feature, you could try using the Factory Relationships and the Sequences to get the same result:

Customer::factory()
    ->has(
        Address::factory(2)
            ->state(new Sequence(
                ['city' => 'Miami'],
                ['city' => 'New York'],
            ))
    )
    ->create();

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dillingham
Comment options

Answer selected by dillingham
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants