8000 Add rule to add HasFactory to Models by jradtilbrook · Pull Request #353 · driftingly/rector-laravel · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add rule to add HasFactory to Models #353

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

jradtilbrook
Copy link
8000 Contributor
@jradtilbrook jradtilbrook commented Jun 20, 2025

This adds a new rule that adds the HasFactory trait to Eloquent models if not present. Useful as part of the other factory related rules to upgrade pre-v8.0 code.

I think might be worth including this in the set and updating some docs - let me know 👍

@jradtilbrook jradtilbrook marked this pull request as ready for review June 20, 2025 08:52
The set is not really complete without it. It'll work if you use the
factory directly, but the other rectors convert to use the static method
which this rector fixes
@peterfox
Copy link
Collaborator

Sorry @jradtilbrook things have been a bit busy lately. It looks overall good, I need to consider adding to the rule group and just the structure of the tests

@peterfox
Copy link
Collaborator
8000 peterfox commented Jun 25, 2025

@jradtilbrook would you be able to refactor your branch to structure your tests like you did in the other branch? #351

@jradtilbrook
Copy link
Contributor Author

👍 I'll try get onto that tonight

@jradtilbrook
Copy link
Contributor Author

@peterfox ready to go now

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
0