Repository navigation
[7.x] Remove Factory "types" - #30867
Merged
Merged
Conversation
- simplify the global helper `factory()`. since the signature is no longer dynamic, we can be a little more explicit in our parameters - remove `defineAs`, `createAs`, `makeAs`, and `rawOf` which were methods specific to factory "types" - update the `FactoryBuilder` to remove references to the "name". we do keep one reference to the name "default" because that is how the callbacks are registered.
browner12
added a commit
to browner12/docs
that referenced
this pull request
Dec 17, 2019
do not merge this unless laravel/framework#30867 is merged. I wanted to get this opened, though, so I wouldn't forget.
browner12
added a commit
to browner12/docs
that referenced
this pull request
Dec 17, 2019
do not merge this unless laravel/framework#30867 is merged. I wanted to get this opened, though, so I wouldn't forget.
GrahamCampbell
requested changes
Dec 18, 2019
| * | ||
| * @param dynamic class|class,name|class,amount|class,name,amount | ||
| * @param string $class | ||
| * @param int $amount |
| return $factory->of($arguments[0], $arguments[1])->times($arguments[2] ?? null); | ||
| } elseif (isset($arguments[1])) { | ||
| return $factory->of($arguments[0])->times($arguments[1]); | ||
| if (isset($amount) && is_int($amount)) { |
Collaborator
There was a problem hiding this comment.
Should be just if (! is_null(amount)) {
Contributor
Author
There was a problem hiding this comment.
yah, i went back and forth on this. looks like it's merged already, so feel to submit a PR.
ibpavlov
added a commit
to ibpavlov/module-lumen
that referenced
this pull request
Apr 7, 2021
With illuminate/database version 7 Factory names are removed - more info laravel/framework#30867 Checking for property `name` ensures that this parameter can be passed.
salmanarshad321
pushed a commit
to salmanarshad321/framework
that referenced
this pull request
Sep 23, 2026
- simplify the global helper `factory()`. since the signature is no longer dynamic, we can be a little more explicit in our parameters - remove `defineAs`, `createAs`, `makeAs`, and `rawOf` which were methods specific to factory "types" - update the `FactoryBuilder` to remove references to the "name". we do keep one reference to the name "default" because that is how the callbacks are registered.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Way back in October 2016, I created the factory "states" feature, and added documentation for it.
#14241
https://github.com/laravel/docs/pull/2735/files
A couple days later Taylor removed all reference to factory "types" from the documentation.
laravel/docs@e38e88b#diff-1620181c4412a72179f78bc2be6c6e68
Going on 3 years here I think we're good to remove the old functionality from the FW in the next major.
It appears the feature was never tested, so everything is still green with no changes to the tests.