Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Improve signature for HasFactory::factory() #34203

Merged
merged 1 commit into from
Sep 10, 2020

Conversation

sebdesign
Copy link
Contributor

The factory method can be called in a number of ways:

// Without arguments
User::factory();

// With count
User::factory(3);

// With count and array state
User::factory(3, ['account_status' => 'suspended']);

// With count and closure state
User::factory(3, function (array $attributes) {
    return ['account_status' => 'suspended'];
});

// With array state
User::factory(['account_status' => 'suspended']);

// With closure state
User::factory(function (array $attributes) {
    return ['account_status' => 'suspended'];
});

This PR adds docblocks for the possible arguments and cleans up the parameter overloading.

@GrahamCampbell GrahamCampbell changed the title Improve signature for HasFactory::factory() [9.x] Improve signature for HasFactory::factory() Sep 8, 2020
@taylorotwell taylorotwell merged commit 0f0f883 into laravel:master Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants