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

Add for method to factory #56

Merged

Conversation

joshhanley
Copy link
Collaborator

This PR allows you to pass the state id through a for() method instead of needing to pass it as a second parameter into the create method.

MyState::factory()->for($myStateId)->create([...]);

The old way will still work

MyState::factory()->create([...], $myStateId);

If for some reason, someone uses both, the ID passed into the create method will take preference.

MyState::factory()->for($myStateId1)->create([...], $myStateId2); // This will have a state ID of 2

@DanielCoulbourne DanielCoulbourne merged commit 6386d4c into hirethunk:main Feb 1, 2024
17 checks passed
@joshhanley joshhanley deleted the add-for-method-to-factory branch April 5, 2024 22:27
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